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
tabs WIP
zadam32439ed00650
diff --git a/src/public/javascripts/services/note_context.js b/src/public/javascripts/services/note_context.jsindex 8562152b58..3f3f536a30 100644--- a/src/public/javascripts/services/note_context.js+++ b/src/public/javascripts/services/note_context.js@@ -42,6 +42,7 @@ class NoteContext {this.$childrenOverview = this.$noteTabContent.find(".children-overview");this.$scriptArea = this.$noteTabContent.find(".note-detail-script-area");this.$savedIndicator = this.$noteTabContent.find(".saved-indicator");+ this.noteChangeDisabled = false;this.isNoteChanged = false;this.components = {};@@ -116,7 +117,7 @@ class NoteContext {}noteChanged() {- if (noteChangeDisabled) {+ if (this.noteChangeDisabled) {return;}diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.jsindex 933370a55b..1f70aee96e 100644--- a/src/public/javascripts/services/note_detail.js+++ b/src/public/javascripts/services/note_detail.js@@ -16,8 +16,6 @@ import importDialog from "../dialogs/import.js";const $noteTabContentsContainer = $("#note-tab-container");const $savedIndicator = $(".saved-indicator");-let noteChangeDisabled = false;-let detailLoadedListeners = [];function getActiveNote() {@@ -163,7 +161,7 @@ async function loadNoteDetail(noteId, newTab = false) {ctx.updateNoteView();- noteChangeDisabled = true;+ ctx.noteChangeDisabled = true;try {ctx.$noteTitle.val(ctx.note.title);@@ -192,7 +190,7 @@ async function loadNoteDetail(noteId, newTab = false) {await ctx.getComponent(ctx.note.type).show(ctx);}finally {- noteChangeDisabled = false;+ ctx.noteChangeDisabled = false;}treeService.setBranchBackgroundBasedOnProtectedStatus(noteId);diff --git a/src/public/javascripts/services/note_detail_code.js b/src/public/javascripts/services/note_detail_code.jsindex a785440b79..e150baff54 100644--- a/src/public/javascripts/services/note_detail_code.js+++ b/src/public/javascripts/services/note_detail_code.js@@ -16,9 +16,9 @@ class NoteDetailCode {this.$component = ctx.$noteTabContent.find('.note-detail-code');this.$executeScriptButton = ctx.$noteTabContent.find(".execute-script-button");- utils.bindShortcut("ctrl+return", this.executeCurrentNote);+ utils.bindShortcut("ctrl+return", () => this.executeCurrentNote());- this.$executeScriptButton.click(this.executeCurrentNote);+ this.$executeScriptButton.click(() => this.executeCurrentNote());}async show() {@@ -50,7 +50,7 @@ class NoteDetailCode {lineWrapping: true});- this.onNoteChange(noteDetailService.noteChanged);+ this.onNoteChange(() => this.ctx.noteChanged());}this.$component.show();diff --git a/src/public/javascripts/services/note_detail_text.js b/src/public/javascripts/services/note_detail_text.jsindex 40ae432ebe..1aba4c3e76 100644--- a/src/public/javascripts/services/note_detail_text.js+++ b/src/public/javascripts/services/note_detail_text.js@@ -45,7 +45,7 @@ class NoteDetailText {placeholder: "Type the content of your note here ..."});- this.onNoteChange(noteDetailService.noteChanged);+ this.onNoteChange(() => this.ctx.noteChanged());}}@@ -86,7 +86,6 @@ class NoteDetailText {this.textEditor.model.document.on('change:data', func);}-cleanup() {if (this.textEditor) {this.textEditor.setData('');