Templater
Templater copied to clipboard
User Scripts silently fail on mobile in 1.10.0
Plugin informations (please complete the following information):
- OS: iOS 15
- Templater version: 1.10.0
- Obsidian version: 1.0.5
- Templater settings:
templates/
folder,templates/js
user scripts folder
Describe the bug
When creating or inserting a template on mobile, if that template contains a user script the template will be inserted without the template logic running. No logs appear (per mobile console in dev tools plugin).
Steps to reproduce:
Add the following user script as nothing.js in your scripts folder:
function nothing() {
// do nothing
return "hello world";
}
module.exports = nothing;
It works on desktop, and as a CustomJS script. Based on my experience this function can be anything, but this is one I can reproduce with.
Next, add a template that calls the user script:
<% tp.user.nothing() %>
Some other text
Insert the template into an empty note on desktop. It will work. Insert on mobile. It will not.
Expected behavior Should work the same on desktop and mobile.
In case it's useful: I was able to work around this issue with my scripts by moving them to CustomJS, then calling them per the example in CustomJS' readme. So I don't think this is an Eta issue; it seems to be something with script calling specifically. The user scripts are listed on mobile in the settings panel.
I'm not sure why the scripts were disabled in the first place, if you force the scripts to load it all seems to run fine for all the cases I am using at least.
Id rather it not work with an error message in the cases people are breaking it than disable it entirely for everyone if its still an issue.