Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: enable/disable snippets from the switcher? #21

Closed
holroy opened this issue Apr 12, 2024 · 6 comments
Closed

feature: enable/disable snippets from the switcher? #21

holroy opened this issue Apr 12, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@holroy
Copy link
Contributor

holroy commented Apr 12, 2024

I'm liking the development of this plugin, and I do understand you wanting to keep it simple, but I also thought about another idea during the night if we had the one command approach: How hard would it be to indicate whether the snippet was active within the quick switcher, and potentially have a key to toggle the enabled/disabled status from the switcher?

Just taking a quick glance it seems like this might take some work, since if I'm correct it only maps the file names directly with the base file name in the first line and the folder in the second line. And to do such a thing like I'm suggesting we would need some indicator maybe on the right to indicate the status. Maybe even a checkbox?

This might need access to parts of the dialog which we don't have. If you don't see/know any way to handle this, don't sweat it, but I just wanted to mention this idea as that would make CSS handling of snippets so much better from my perspective where I change them a lot when answering on the forum, so I'm getting kind of bored enabling/disabling them.

@Zachatoo Zachatoo added the enhancement New feature or request label Apr 12, 2024
@Zachatoo
Copy link
Owner

I think this is a good idea and within the scope of this plugin.

I'm more inclined to add another "instruction" for toggling the enabled status of a CSS snippet as opposed to a checkbox, to keep the UI similar to the quick switcher.

I definitely like having the enabled status somewhere in the suggestion, probably on the right side as you suggested. I would suggest "Enabled" and "Disabled" as the words to use if we don't use checkboxes.

A quick win might be to add a command that toggles the enabled status of the CSS snippet you're currently editing, similar to the command that deletes the CSS snippet you're currently editing.

@holroy
Copy link
Contributor Author

holroy commented Apr 12, 2024

How to toggle doesn't matter that much to me, but I would like some visual indication as to whether it was enabled or not, but I'm not sure how to get that outside of hacks like modifying the file name before presentation or stuff like that...

@holroy
Copy link
Contributor Author

holroy commented Apr 13, 2024

Ideally I would like for something to appear in the right margin, but I reckon it's a whole lot easier to actually prefix the file name with either ☑︎ if enabled, or if disabled. This could then easily be removed when handling the chosen item.

I'm also not sure how to disable/enable a snippet from Typescript. (a few minutes later) Then again you do already enable newly created snippets, so you've got the code for setting that at least. Where did you get that code piece from? Is there also a getEnabled() call?

holroy added a commit to holroy/obsidian-css-editor that referenced this issue Apr 13, 2024
Implementing Zachatoo#21 enabling enabling/disabling snippets from the switcher.
@holroy
Copy link
Contributor Author

holroy commented Apr 13, 2024

I'm not totally sure on whether my logic is sound regarding extending the chooser in obsidian.d.ts, but it do seem to work, so please do review the code thoroughly, Zachatoo

@holroy
Copy link
Contributor Author

holroy commented Apr 13, 2024

If I must say it myself, I think this plugin looks better every day that goes by!

@Zachatoo
Copy link
Owner

Thanks for working on this! Released in 1.1.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants