What I’m trying to do
As we know, using tp.system.suggester()
opens a dropdown like menu when the Template is initialized while tp.file.cursor()
moves the cursor to whatever position it’s called.
I would like to trigger tp.system.suggester()
exclusively when the next tp.file.cursor()
is called. It’s worth saying that due to my flow using only tp.system.suggester()
along with tp.system.prompt()
on file creation isn’t an option.
Hypothetical Example for Simplicity
- On file creation I will get prompted for the color limited to **red **or blue.
- I have to fill in the description of the wings.
- Some may suggest to use
tp.system.prompt()
but I can’t because it blocks the file contents that I must keep seeing while filling the file.
- Some may suggest to use
- Choose the size limited only to large or short.
Color: <% tp.system.suggester(["blue", "red"], ["blue", "red"]) %>
Wings: <% tp.file.cursor(1) %>
Size: <% tp.file.cursor(2); tp.system.suggester(["large", "short"], ["large", "short"]) /* This line will fail unless `tp.file.cursor(2);` is removed */ %>
Things I have tried
- Tried to place both instructions in the same line. (Same code as in the example)
-
<% tp.file.cursor(2); tp.system.suggester(["large", "short"], ["large", "short"]) %>
- Error log:
Templater Error: Template parsing error, aborting. Template syntax error: missing ) after argument list
- I’m sure I didn’t miss a parenthesis.
- Error log:
-
- Googled for this or similar issues.
- Reviewed Templater’s source code but couldn’t figure this out. But at least now I know that
tp.file.cursor()
returns a string and not a Promise as I initally thought.