nathonius / obsidian-collapse-all

MIT License
92 stars 2 forks source link

Use built-in icons #14

Closed nathonius closed 1 year ago

nathonius commented 3 years ago

Can use global setIcon to create icons for collapsing, no need for custom icon svg strings.

claremacrae commented 3 years ago

Re the "good first issue" label, could you possible add some hints please - I'd like to contribute to this, butgot stuck

I had a look at this, and wasn't able to figure out how to update these lines to use setIcon:

https://github.com/OfficerHalf/obsidian-collapse-all/blob/c2144f3c4c35b39bc6ea28f80f4e51ac5a131995/src/plugin.ts#L189-L191

(I mean, what to use instead of button.innerHTML - I can handle the ternary operator easily)

In another project based on this, I tried doing button.setIcon() - and got the text displayed... So I must be missing something ...

Note to self: I would also need to work out how to find the built-in icons to match the custom ones currently in use....

nathonius commented 3 years ago

So the icons used in this plugin are just default icons from obsidian. I think chevron-up and chevron-down. Should be able to use the gobal setIcon method on the containers for the icons to add them instead of using svg strings.

I add and use a custom icon in my obsidian-trello plugin, if you want an example.

nathonius commented 3 years ago

To find built in icons, honestly one of the easiest ways is the icon swapper plugin. It's not its intended purpose but it has a list of all the built in icons in the plugin settings.

nathonius commented 3 years ago

setIcon is gobal. You use iirc it's setIcon(parentElement, 'icon-name'). The order could be swapped I don't remember.

claremacrae commented 2 years ago

Wow there's a lot of issues with super-cryptic summary lines!

Oops - sorry - wrong issue :-)

nathonius commented 1 year ago

No longer applicable.