support of including JS subnotes when executing

This commit is contained in:
azivner
2018-01-23 22:53:27 -05:00
parent 6f79a1c05b
commit 4ed2dc9f53
2 changed files with 49 additions and 1 deletions

View File

@@ -198,9 +198,11 @@ const noteEditor = (function() {
async function executeScript() {
if (getCurrentNoteType() === 'code') {
// we take script value directly from editor so we don't need to wait for it to be saved
const script = codeEditor.getValue();
const subTreeScripts = await server.get('script/subtree/' + getCurrentNoteId());
eval("(async function() {" + script + "})()");
eval("(async function() {" + subTreeScripts + script + "})()");
}
}