shabegom / buttons

Buttons in Obsidian
The Unlicense
459 stars 47 forks source link

Feature: add a "group" parameter to group buttons and make them work together #10

Closed yhoebeke closed 3 years ago

yhoebeke commented 3 years ago

Hello! Thank you for this wonderful plugin.

As discussed in discord, adding a "group" parameter would be very useful.

Example usage : I would like to have a button that inserts a template containing plenty of various buttons (let's say each of these buttons would insert a specific checklist/template). Once I click on the button I would like to have the template replace the button, but also all of the other buttons.

shabegom commented 3 years ago

Cool idea! Right now remove is looking for the button name. If multiple buttons have the same name it'll remove them all. That's a hacky workaround while I look into a group remove. I guess it would be hard to know what button does what if they all had the same name. 😅

```button name insert type prepend template action template 1 remove true ```

```button name insert type prepend template action template 2 remove true ```

yhoebeke commented 3 years ago

I guess one could distinguish between the buttons with css classes, but not sure it is worth the hassle haha. I am really looking forward to this group feature as it will allow us to create a sort of contextual menus by combining buttons with templates.

And the great thing is that your plugin works on mobile ❤

yhoebeke commented 3 years ago

Hello again @shabegom, were you able to make progress on this? :) I was wondering whether using the "id" instead of the "name" to decide how buttons are removed could be a quick fix?

shabegom commented 3 years ago

Hey @yhoebeke!

I've started work on this, but wrapped it into a larger update for buttons that has hit some roadblocks. I was thinking the same as you, if the button has the same ID it will be removed.

If I don't make progress on the larger update this weekend I'll think about pulling this feature out into its own release.

Thanks for your patience!

shabegom commented 3 years ago

@yhoebeke I've added a new button block id feature and updated the remove argument to allow removing buttons by ids. If this works for you I'll close out this issue!

yhoebeke commented 3 years ago

@yhoebeke I've added a new button block id feature and updated the remove argument to allow removing buttons by ids. If this works for you I'll close out this issue!

Thank you very much for the update @shabegom ! I will try it out.