This commit is contained in:
zadam 2019-05-04 14:34:03 +02:00
parent ff41904d72
commit 32439ed006
4 changed files with 8 additions and 10 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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();

View file

@ -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('');