Zachatoo / obsidian-css-editor

Edit CSS snippets in Obsidian.
MIT License
57 stars 2 forks source link

Feature: Enable/disable snippets from switcher #22

Closed holroy closed 6 months ago

holroy commented 6 months ago

Implementing #21 enabling enabling/disabling snippets from the switcher.

With these changes enabled now the switcher looks like:

image

I've chosen Tab as the character to toggle enabled/disabled, and the color for enabled is the accented color.

Zachatoo commented 6 months ago

I think we should not show the enabled/disabled text when typing something that does not exist. A non-existing CSS snippet isn't really enabled or disabled.

image
Zachatoo commented 6 months ago

I like using tab for toggling, though it may not be accessible on mobile. Though we have this same issue with deleting. I recommend we also add a command to toggle the enabled status of the currently visible CSS snippet, similar to the command I've added for deleting a CSS snippet.

holroy commented 6 months ago

I forgot about the command, but I initially thought about it, and found myself reasoning that would a command be useful if you don't know the current state? And after that I thought about your could I show this in the file itself, and found no solution.

Come to think about it now, I'm wondering how hard would it be to have the command display the state, and offer to either cancel or toggle it? Or would you like to have a "blind" command which just toggles it anyways?

holroy commented 6 months ago

I'm off to work so I can't do any changes until tonight (aka 10-12 hours or so). Hopefully I'll get response on my responses by then, and the changes should be easy enough to implement.

holroy commented 6 months ago

I think we should not show the enabled/disabled text when typing something that does not exist. A non-existing CSS snippet isn't really enabled or disabled.

This one bugged me too a little, but I'm not sure how to avoid it when I wrote the code, but I could potentially implement an existing check before adding it to the rendered selection... I'll try that.

holroy commented 6 months ago

OK, now I've corrected the texts, removed the "disabled" state related to new files, and added the command to toggle the state from within the file.

Zachatoo commented 6 months ago

Thanks for your contribution!! And thank you for your patience, I know I can be picky when it comes to code.

holroy commented 6 months ago

Not even considered a problem, as I can be very picky myself.