Comments (6)
Thanks!
That would be possible, but I‘m opposed to implementing it directly in the buttons chooser for two reasons:
- I don‘t use it on desktop, I only added support for it on request (see #6), and I don‘t want to maintain additional complexity that I’m not using.
- I hook into the
file-open
event which gets fired each time a new pane gets opened, the file in the current pane changes or a different pane gets clicked. Then I check for every button whether it‘s there. I don‘t really want to make it more complex and check more conditions. The performance might not be that important with only this plugin, but the more plugins start hooking into events, it might lead to lags in the future. I‘m not exactly sure of performance implications, but I‘d like to keep it as lean as possible. I used to check whether a pane was already opened (the ID stays the same for each pane) by keeping track of the ID in a set, but that proved to be unreliable as soon as non-markdown panes were involved.
If you look at the DOM, you can see that there are multiple buttons, depending on the pane, that are hidden with display: none
. I give the buttons distinct classes based on their command ID, so you should be able to hide them with a snippet.
Example:
.is-desktop .view-action .switcher:open {
display: none;
}
I didn‘t check that selector yet and I‘ll also add one more class to make removing the buttons onunload independent of the settings by request of Licat. You can add such a snippet already and the class I‘m adding shouldn‘t break the snippets, but I would wait until I have released the new version.
What I could imagine to do is adding a new setting to automatically add such css rules based on a dropdown menu to either do nothing/hide on desktop/hide on mobile, if the setting to enable them on desktop is enabled. That also makes it less complex for users who only want to use it on mobile.
That being said, I don‘t know whether it is more resource-intensive to apply the CSS or check extra conditions. Considering that Obsidian adds these buttons anyway and hides them with display: none
, I think it is better to do that with CSS.
What do you think?
from customizable-page-header-buttons.
Although the extra checks would only happen for new panes.. Hmm..
In any case, I don't want another suggester for selecting it, I want to keep the initial configuration as simple as possible.
Also, if I don't add this before approval, then it could be a breaking change to many users, depending on how I design it.
The CSS option I could always add at a later point without breaking people's workflow.
from customizable-page-header-buttons.
You can make changes while waiting approval, just make sure the current "Release" is stable. I can't say what the best implementation is, but it will be useful.
I do always say though, build what you use. Nothing works better than when you work with it yourself for shaking the features down.
Thanks for considering this request.
from customizable-page-header-buttons.
I've looked at the DOM now, there is no .is-desktop
class. There is .is-mobile
. So my CSS approach wouldn't work.
from customizable-page-header-buttons.
You can make changes while waiting approval, just make sure the current "Release" is stable.
Yes, what I meant is that I'd need to decide now how to implement it because I don't want to introduce breaking changes once it's approved.
from customizable-page-header-buttons.
I'll think about it, there might be a simple way after all.
from customizable-page-header-buttons.
Related Issues (20)
- Option to change page header font HOT 1
- wow amazing, but seem to mess with my YAML header files, anyway to fix that? HOT 2
- [Feature Request 😅] Customizable Titlebar HOT 3
- Add ability to increase spacing (or 'blank') between symbols in toolbar HOT 4
- [Feature Request] Command container for center of titlebar HOT 1
- Add additional icons
- Lucide icons
- Two Line Custom Title Bar HOT 1
- Compatibility with pane-relief plugin HOT 12
- [Feature Request] Buttons based on Workspaces HOT 2
- Add css snippets as list items HOT 5
- Getting Only Added Commands Only On One Pane HOT 3
- FR: Toggle to remove page mode button on desktop
- The customizable page header buttons hide the page title (Mobile version) HOT 9
- Creates empty leaf when closing file HOT 4
- Unclosable empty pane created after switching between panes, when all panes pinned HOT 3
- Right click for pane relief navigation registers as a left click HOT 5
- Show buttons based on frontmatter
- Page header buttons repeat when not is in separate window.
- Buttons Are Not Showing Up on Title Bars in 0.16.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from customizable-page-header-buttons.