Closed Rhydderch closed 5 months ago
Ah interesting bug. It's a bit of a race between the button removal and insert the text. It definitely tries to do the removal first.
I wonder if I can make it insert below the button...
In the meantime, a workaround would be to execute the command inside a templater template and then use an append template button.
I guess making it insert just below the button could work!
In the meantime, a workaround would be to execute the command inside a templater template and then use an append template button. I did not know we could call commands inside templater templates. I will check the docs (but if you have a code example at hand that would great)
I did not know we could call commands inside templater templates. I will check the docs (but if you have a code example at hand that would great)
Yeah! So I hook into obsidian's command execution method (this is how buttons works too):
<%* app.commands.executeCommandById("ics-plugin:import_events") %>
I did not know we could call commands inside templater templates. I will check the docs (but if you have a code example at hand that would great)
Yeah! So I hook into obsidian's command execution method (this is how buttons works too):
<%* app.commands.executeCommandById("ics-plugin:import_events") %>
Great, I did not know we could do this. Thanks a lot for this!
Hello,
I found a bug: if the command called by the button inserts text, the text will be inserted inside the code of the button and the button will not be removed if remove=true.
To reproduce:
Perhaps one way to solve this would be to first remove the button then launch the command. Another way would be to let users append/prepend/etc with commands in case they return text.
Note: the bug only happens if one stays in the "preview" mode. If I click the button, then quickly switch to edit mode, the text is entered correctly.