mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 00:05:50 +01:00
note complement is now loaded through tree cache
This commit is contained in:
@@ -39,18 +39,11 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
this.spacedUpdate = new SpacedUpdate(async () => {
|
||||
const {note} = this.tabContext;
|
||||
const {noteId} = note;
|
||||
const noteComplement = await this.tabContext.getNoteComplement();
|
||||
|
||||
// FIXME hack
|
||||
const dto = note.dto;
|
||||
dto.content = noteComplement.content = this.getTypeWidget().getContent();
|
||||
dto.content = this.getTypeWidget().getContent();
|
||||
|
||||
const resp = await server.put('notes/' + noteId, dto, this.componentId);
|
||||
|
||||
noteComplement.dateModified = resp.dateModified;
|
||||
noteComplement.utcDateModified = resp.utcDateModified;
|
||||
|
||||
this.trigger('noteChangesSaved', {noteId})
|
||||
await server.put('notes/' + noteId, dto, this.componentId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -226,9 +219,9 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
}
|
||||
|
||||
async entitiesReloadedListener({loadResults}) {
|
||||
if (loadResults.isNoteContentReloaded(this.noteId, this.componentId)) {
|
||||
this.tabContext.noteComplement = await noteDetailService.loadNoteComplement(this.noteId);
|
||||
// we should test what happens when the loaded note is deleted
|
||||
|
||||
if (loadResults.isNoteContentReloaded(this.noteId, this.componentId)) {
|
||||
this.refreshWithNote(this.note, this.notePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,13 +67,6 @@ class NoteInfoWidget extends StandardWidget {
|
||||
.attr("title", note.mime);
|
||||
}
|
||||
|
||||
// this is interesting for this widget since dateModified had to change after update
|
||||
noteChangesSavedListener({noteId}) {
|
||||
if (this.isNote(noteId)) {
|
||||
this.refreshWithNote(this.note, this.notePath);
|
||||
}
|
||||
}
|
||||
|
||||
syncDataListener({data}) {
|
||||
if (data.find(sd => sd.entityName === 'notes' && this.isNote(sd.entityId))) {
|
||||
this.refresh();
|
||||
|
||||
@@ -34,13 +34,7 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
||||
const noteId = this.tabContext.note.noteId;
|
||||
const title = this.$noteTitle.val();
|
||||
|
||||
const resp = await server.put(`notes/${noteId}/change-title`, {title});
|
||||
|
||||
// FIXME: minor - does not propagate to other tab contexts with this note though
|
||||
this.tabContext.note.dateModified = resp.dateModified;
|
||||
this.tabContext.note.utcDateModified = resp.utcDateModified;
|
||||
|
||||
this.trigger('noteChangesSaved', {noteId})
|
||||
await server.put(`notes/${noteId}/change-title`, {title});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user