fix some issues

This commit is contained in:
azivner 2018-08-22 14:40:49 +02:00
parent 09b610701d
commit 17348a9cfe
3 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,7 @@ let codeEditorInitialized;
async function show() {
codeEditorInitialized = false;
$noteDetailRender.show();
$noteDetailRender.empty().show();
await render();
}

View File

@ -272,6 +272,13 @@ async function deleteNote(branch) {
attribute.isDeleted = true;
await attribute.save();
}
const targetAttributes = await repository.getEntities("SELECT * FROM attributes WHERE type = 'relation' AND isDeleted = 0 AND value = ?", [note.noteId]);
for (const attribute of targetAttributes) {
attribute.isDeleted = true;
await attribute.save();
}
}
}

View File

@ -129,7 +129,9 @@ async function getScriptBundle(note, root = true, scriptEnv = null, includedNote
apiContext.modules['${note.noteId}'] = {};
${root ? 'return ' : ''}await (async function(exports, module, require, api` + (modules.length > 0 ? ', ' : '') +
modules.map(child => sanitizeVariableName(child.title)).join(', ') + `) {
try {${note.content};} catch (e) { throw new Error("Load of script note \\"${note.title}\\" (${note.noteId}) failed with: " + e.message); }
try {
${note.content};
} catch (e) { throw new Error("Load of script note \\"${note.title}\\" (${note.noteId}) failed with: " + e.message); }
if (!module.exports) module.exports = {};
for (const exportKey in exports) module.exports[exportKey] = exports[exportKey];
})({}, apiContext.modules['${note.noteId}'], apiContext.require(${JSON.stringify(moduleNoteIds)}), apiContext.apis['${note.noteId}']` + (modules.length > 0 ? ', ' : '') +