shabegom / buttons

Buttons in Obsidian
The Unlicense
453 stars 47 forks source link

Append template (possibly) conflicts with core Templates plugin #219

Open AlbinaMuzafarova opened 2 months ago

AlbinaMuzafarova commented 2 months ago

Hi,

I tried to use the following button:

name update
type append template
action Action - scan 

^button-update

and there was no action upon clicking it until I've disabled the Templates core plugin. I am new to Obsidian and was under impression that buttons could be used with that core plugin on. The template itself (Action - scan) seems to be fine as it executes without errors when creating notes with the Templater community plugin (or with that button when Templates deactivated).

Not sure if it's related or helpful, but I also keep running into issue with append command buttons, e.g.:

name update3
type append command
action Templates: Insert template

^button-update3

In the console, it shows VM199 plugin:buttons:1432 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'lineEnd'). When clicking on the link in the error, it goes to the following if-statement, underlining the buttonStart.lineEnd + 2,0); part:

    if (args.type.includes("append")) {
        app.workspace.getActiveViewOfType(obsidian.MarkdownView).editor.setCursor(buttonStart.lineEnd + 2, 0);
        app.commands.executeCommandById(command.id);
    }

I wasn't able to make it work so far despite the error message.

Buttons version: 0.5.1 Obsidian version: 1.5.12 Templater version: 2.2.3