refactoring of script subtree execution

This commit is contained in:
azivner
2018-01-25 23:22:19 -05:00
parent aad5ea577f
commit a42fd9b090
4 changed files with 25 additions and 7 deletions

View File

@@ -216,11 +216,12 @@ 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();
// make sure note is saved so we load latest changes
await saveNoteIfChanged();
const subTreeScripts = await server.get('script/subtree/' + getCurrentNoteId());
eval("(async function() {" + subTreeScripts + script + "})()");
eval("(async function() {" + subTreeScripts + "})()");
}
}