mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
wip
This commit is contained in:
@@ -43,7 +43,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
const dto = note.dto;
|
||||
dto.content = noteFull.content = this.getTypeWidget().getContent();
|
||||
|
||||
const resp = await server.put('notes/' + noteId, dto);
|
||||
const resp = await server.put('notes/' + noteId, dto, this.componentId);
|
||||
|
||||
// FIXME: minor - does not propagate to other tab contexts with this note though
|
||||
noteFull.dateModified = resp.dateModified;
|
||||
@@ -220,9 +220,9 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
notesReloadedListener({loadResults}) {
|
||||
if (loadResults.isNoteReloaded(this.noteId, this.componentId)) {
|
||||
this.refresh();
|
||||
}
|
||||
notesReloadedListener(data) {
|
||||
super.notesReloadedListener(data);
|
||||
|
||||
return false; // stop propagation to children
|
||||
}
|
||||
}
|
||||
@@ -69,10 +69,8 @@ class NoteInfoWidget extends StandardWidget {
|
||||
|
||||
// this is interesting for this widget since dateModified had to change after update
|
||||
noteChangesSavedListener({noteId}) {
|
||||
const note = this.tabContext.note;
|
||||
|
||||
if (note && note.noteId === noteId) {
|
||||
this.refreshWithNote(note);
|
||||
if (this.isNote(noteId)) {
|
||||
this.refreshWithNote(this.note, this.notePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,17 +78,6 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
||||
});
|
||||
}
|
||||
|
||||
noteTitleChangedListener({tabId, title, noteId}) {
|
||||
if (tabId === this.tabContext.tabId
|
||||
|| !this.tabContext.note
|
||||
|| this.tabContext.note.noteId !== noteId) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.$noteTitle.val(title);
|
||||
}
|
||||
|
||||
async refreshWithNote(note) {
|
||||
this.$noteTitle.val(note.title);
|
||||
|
||||
|
||||
@@ -427,16 +427,11 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
}
|
||||
}
|
||||
|
||||
async notesReloadedListener({ noteIds, activateNotePath }) {
|
||||
if (!activateNotePath) {
|
||||
const activeNode = this.getActiveNode();
|
||||
async notesReloadedListener({loadResults}) {
|
||||
const activeNode = this.getActiveNode();
|
||||
const activateNotePath = activeNode ? await treeService.getNotePath(activeNode) : null;
|
||||
|
||||
if (activeNode) {
|
||||
activateNotePath = await treeService.getNotePath(activeNode);
|
||||
}
|
||||
}
|
||||
|
||||
for (const noteId of noteIds) {
|
||||
for (const noteId of loadResults.getNoteIds()) {
|
||||
for (const node of this.getNodesByNoteId(noteId)) {
|
||||
const branch = treeCache.getBranch(node.data.branchId, true);
|
||||
|
||||
@@ -460,12 +455,6 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
}
|
||||
}
|
||||
|
||||
noteTitleChangedListener({noteId}) {
|
||||
for (const node of this.getNodesByNoteId(noteId)) {
|
||||
treeService.setNodeTitleWithPrefix(node);
|
||||
}
|
||||
}
|
||||
|
||||
async createNoteAfterListener() {
|
||||
const node = this.getActiveNode();
|
||||
const parentNoteId = node.data.parentNoteId;
|
||||
|
||||
@@ -24,6 +24,10 @@ export default class TabAwareWidget extends BasicWidget {
|
||||
return this.note && this.note.noteId;
|
||||
}
|
||||
|
||||
get notePath() {
|
||||
return this.tabContext && this.tabContext.notePath;
|
||||
}
|
||||
|
||||
tabNoteSwitchedListener({tabId}) {
|
||||
if (this.isTab(tabId)) {
|
||||
this.noteSwitched();
|
||||
@@ -39,20 +43,26 @@ export default class TabAwareWidget extends BasicWidget {
|
||||
}
|
||||
|
||||
refresh() {
|
||||
if (this.tabContext && this.tabContext.note) {
|
||||
if (this.note) {
|
||||
this.toggle(true);
|
||||
this.refreshWithNote(this.tabContext.note, this.tabContext.notePath);
|
||||
this.refreshWithNote(this.note, this.notePath);
|
||||
}
|
||||
else {
|
||||
this.toggle(false);
|
||||
}
|
||||
}
|
||||
|
||||
refreshWithNote(note) {}
|
||||
refreshWithNote(note, notePath) {}
|
||||
|
||||
activeTabChangedListener() {
|
||||
this.tabContext = this.appContext.getActiveTabContext();
|
||||
|
||||
this.activeTabChanged();
|
||||
}
|
||||
|
||||
notesReloadedListener({loadResults}) {
|
||||
if (loadResults.isNoteReloaded(this.noteId, this.componentId)) {
|
||||
this.refreshWithNote(this.note, this.notePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,13 +498,6 @@ export default class TabRowWidget extends BasicWidget {
|
||||
return this.$widget.find(`[data-tab-id='${tabId}']`);
|
||||
}
|
||||
|
||||
noteTitleChangedListener({title, noteId}) {
|
||||
this.appContext.getTabContexts()
|
||||
.filter(tc => tc.note && tc.note.noteId === noteId)
|
||||
.map(tc => this.getTabById(tc.tabId))
|
||||
.forEach($el => $el.find('.note-tab-title').text(title));
|
||||
}
|
||||
|
||||
tabRemovedListener({tabId}) {
|
||||
this.removeTab(tabId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user