shabegom / buttons

Buttons in Obsidian
The Unlicense
453 stars 47 forks source link

[BUG] Button Command literally disapears after execution #191

Closed Osuppa closed 5 months ago

Osuppa commented 10 months ago

I'm using the code below and my button content is disappearing after the execution (that isn't supposed to happen)

name Criar nova nota
type command
action <%* const templateNote = tp.file.find_tfile("NoteTemplate"); const folderNote = app.vault.getAbstractFileByPath("Notas"); let prompt = await tp.system.prompt("Nome da nota:"); let filenameNote = await prompt; await tp.file.create_new(templateNote, filenameNote, true, folderNote); %> templater true

Osuppa commented 10 months ago

The error is when executing prompt const and filenameNote let

<%* const templateNote = tp.file.find_tfile("NoteTemplate"); const folderNote = app.vault.getAbstractFileByPath("Notas"); let prompt = await tp.system.prompt("Nome da nota:"); let filenameNote = await prompt; await tp.file.create_new(templateNote, filenameNote, true, folderNote); %>

Osuppa commented 10 months ago

I'm seeing that the await is strangely cleaning the button command content

FeralFlora commented 8 months ago

Could this be because you have "Trigger Templater on new file creation" enabled?

shabegom commented 5 months ago

should be fixed. reopen if still an issue.