Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix some issues
azivner17348a9cfec9
diff --git a/src/public/javascripts/services/note_detail_render.js b/src/public/javascripts/services/note_detail_render.jsindex 24357e0aff..5b1dec5216 100644--- a/src/public/javascripts/services/note_detail_render.js+++ b/src/public/javascripts/services/note_detail_render.js@@ -13,7 +13,7 @@ let codeEditorInitialized;async function show() {codeEditorInitialized = false;- $noteDetailRender.show();+ $noteDetailRender.empty().show();await render();}diff --git a/src/services/notes.js b/src/services/notes.jsindex 32a55d18ec..488bcb9cf8 100644--- a/src/services/notes.js+++ b/src/services/notes.js@@ -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();+ }}}diff --git a/src/services/script.js b/src/services/script.jsindex f5fbb4d15a..47364fb978 100644--- a/src/services/script.js+++ b/src/services/script.js@@ -129,7 +129,9 @@ async function getScriptBundle(note, root = true, scriptEnv = null, includedNoteapiContext.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 ? ', ' : '') +