buttons icon indicating copy to clipboard operation
buttons copied to clipboard

tp.user command in type note makes button dissapear

Open ZobaJakColbert opened this issue 4 months ago • 4 comments

I was using this code to add new accumulator to my collection. It was getting current number of accu and adding one with .js script named: getThisAcumulatorNum. But now button don't show up. If I remove this line <% tp.user.getThisAcumulatorNum(tp, "AA") %> button reappears. How to fix this?

```button
name Add accu AA
type note(Accu/AA/<% tp.user.getThisAcumulatorNum(tp, "AA") %>, split) template
action Template - Accu
templater true
\```

remove "\" before last "```"

ZobaJakColbert avatar Feb 13 '24 22:02 ZobaJakColbert

I'm seeing this behavior as well with embedded tp.user commands causing the button to not render.

From Console:

app.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'path') at t. (app.js:1:722944) at app.js:1:237258 at Object.next (app.js:1:237363) at app.js:1:236279 at new Promise () at v (app.js:1:236024) at t.read (app.js:1:722825) at InternalModuleFile.generate_content (plugin:templater-obsidian:2402:28) at InternalModuleFile.create_dynamic_templates (plugin:templater-obsidian:2395:54) at InternalModuleFile.generate_object (plugin:templater-obsidian:2310:16) at InternalFunctions.generate_object (plugin:templater-obsidian:2892:60) at async templater$1 (plugin:buttons:989:23) at async eval (plugin:buttons:4311:38)

cacharbe avatar Feb 15 '24 21:02 cacharbe

Very strange that the whole button disappears. I'm guessing the way user script plugins work have changed in some way since I implemented the handling.

shabegom avatar Feb 17 '24 13:02 shabegom

@ZobaJakColbert can you post the script code so I have a minimal reproducible example? I currently don't have a user scripts.

shabegom avatar Feb 17 '24 13:02 shabegom

I have repro'd the bug with the following minimal (change txt to js file):

name Add GM Session
type note(foo/bar/<% tp.user.getInt(tp) %>, split) template
action session-gm
templater true

^button-NewInt

getInt.txt

cacharbe avatar Feb 17 '24 14:02 cacharbe

I am seeing this as well. Templater: v2.2.3 Buttons: v0.5.1

Tejeev avatar Apr 30 '24 05:04 Tejeev