Frontmatter object; set variable in js script and pass it along on creation #962
Unanswered
Cabbage363
asked this question in
Help
Replies: 1 comment
-
Sorry for the stupid question but what is the use case? I couldn't gather that from your info. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good day,
So, I have created a simple script that is generic to my purposes and hope to be able to reuse the functionality if I can get this working.
It is currently tied to a button that activates the script, to which then processes and then generates a new Note with specific parameters.
-> Button
-> script.js
From my understanding is that the tp.frontmatteris just a storage object, like res.locals. However upon the creation of the new Note the tp.frontmatter becomes empty and there are not pre-set keys stored. Each variation of this Note creation has different keys generated and stored. The simple solution is to generated them in a Templater script <% ie. in here %> and set them into the tp.frontmatter object so that they can be passed along. However, with the various different scopes I plan on using this, that may become tedious, rather then just changing a mapping function in the JS script.
I assumed that this is because the tp.frontmatter is in reference of the current Note of where the Button is clicked and then not passed into the new Note (which has its own instance of tp.frontmatter).
Any advise would be greatly appreciated!
thank
Beta Was this translation helpful? Give feedback.
All reactions