Coder Social home page Coder Social logo

Comments (6)

kometenstaub avatar kometenstaub commented on August 22, 2024

Thanks!

That would be possible, but I‘m opposed to implementing it directly in the buttons chooser for two reasons:

  1. 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.
  2. 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.

kometenstaub avatar kometenstaub commented on August 22, 2024

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.

TfTHacker avatar TfTHacker commented on August 22, 2024

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.

kometenstaub avatar kometenstaub commented on August 22, 2024

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.

kometenstaub avatar kometenstaub commented on August 22, 2024

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.

kometenstaub avatar kometenstaub commented on August 22, 2024

I'll think about it, there might be a simple way after all.

from customizable-page-header-buttons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.