mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
tabs WIP
This commit is contained in:
parent
ff41904d72
commit
32439ed006
@ -42,6 +42,7 @@ class NoteContext {
|
|||||||
this.$childrenOverview = this.$noteTabContent.find(".children-overview");
|
this.$childrenOverview = this.$noteTabContent.find(".children-overview");
|
||||||
this.$scriptArea = this.$noteTabContent.find(".note-detail-script-area");
|
this.$scriptArea = this.$noteTabContent.find(".note-detail-script-area");
|
||||||
this.$savedIndicator = this.$noteTabContent.find(".saved-indicator");
|
this.$savedIndicator = this.$noteTabContent.find(".saved-indicator");
|
||||||
|
this.noteChangeDisabled = false;
|
||||||
this.isNoteChanged = false;
|
this.isNoteChanged = false;
|
||||||
this.components = {};
|
this.components = {};
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ class NoteContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noteChanged() {
|
noteChanged() {
|
||||||
if (noteChangeDisabled) {
|
if (this.noteChangeDisabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@ import importDialog from "../dialogs/import.js";
|
|||||||
const $noteTabContentsContainer = $("#note-tab-container");
|
const $noteTabContentsContainer = $("#note-tab-container");
|
||||||
const $savedIndicator = $(".saved-indicator");
|
const $savedIndicator = $(".saved-indicator");
|
||||||
|
|
||||||
let noteChangeDisabled = false;
|
|
||||||
|
|
||||||
let detailLoadedListeners = [];
|
let detailLoadedListeners = [];
|
||||||
|
|
||||||
function getActiveNote() {
|
function getActiveNote() {
|
||||||
@ -163,7 +161,7 @@ async function loadNoteDetail(noteId, newTab = false) {
|
|||||||
|
|
||||||
ctx.updateNoteView();
|
ctx.updateNoteView();
|
||||||
|
|
||||||
noteChangeDisabled = true;
|
ctx.noteChangeDisabled = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ctx.$noteTitle.val(ctx.note.title);
|
ctx.$noteTitle.val(ctx.note.title);
|
||||||
@ -192,7 +190,7 @@ async function loadNoteDetail(noteId, newTab = false) {
|
|||||||
await ctx.getComponent(ctx.note.type).show(ctx);
|
await ctx.getComponent(ctx.note.type).show(ctx);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
noteChangeDisabled = false;
|
ctx.noteChangeDisabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
treeService.setBranchBackgroundBasedOnProtectedStatus(noteId);
|
treeService.setBranchBackgroundBasedOnProtectedStatus(noteId);
|
||||||
|
@ -16,9 +16,9 @@ class NoteDetailCode {
|
|||||||
this.$component = ctx.$noteTabContent.find('.note-detail-code');
|
this.$component = ctx.$noteTabContent.find('.note-detail-code');
|
||||||
this.$executeScriptButton = ctx.$noteTabContent.find(".execute-script-button");
|
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() {
|
async show() {
|
||||||
@ -50,7 +50,7 @@ class NoteDetailCode {
|
|||||||
lineWrapping: true
|
lineWrapping: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onNoteChange(noteDetailService.noteChanged);
|
this.onNoteChange(() => this.ctx.noteChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$component.show();
|
this.$component.show();
|
||||||
|
@ -45,7 +45,7 @@ class NoteDetailText {
|
|||||||
placeholder: "Type the content of your note here ..."
|
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);
|
this.textEditor.model.document.on('change:data', func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
if (this.textEditor) {
|
if (this.textEditor) {
|
||||||
this.textEditor.setData('');
|
this.textEditor.setData('');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user