attachment improvements

This commit is contained in:
zadam
2023-04-11 17:45:51 +02:00
parent a5f0b2a81e
commit 54c0268593
10 changed files with 191 additions and 47 deletions

View File

@@ -39,6 +39,8 @@ class NoteContext extends Component {
async setNote(inputNotePath, opts = {}) {
opts.triggerSwitchEvent = opts.triggerSwitchEvent !== undefined ? opts.triggerSwitchEvent : true;
opts.viewScope = opts.viewScope || {};
opts.viewScope.viewMode = opts.viewScope.viewMode || "default";
const resolvedNotePath = await this.getResolvedNotePath(inputNotePath);
@@ -46,6 +48,10 @@ class NoteContext extends Component {
return;
}
if (this.notePath === resolvedNotePath && utils.areObjectsEqual(this.viewScope, opts.viewScope)) {
return;
}
await this.triggerEvent('beforeNoteSwitch', {noteContext: this});
utils.closeActiveDialog();
@@ -53,8 +59,7 @@ class NoteContext extends Component {
this.notePath = resolvedNotePath;
({noteId: this.noteId, parentNoteId: this.parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(resolvedNotePath));
this.viewScope = opts.viewScope || {};
this.viewScope.viewMode = this.viewScope.viewMode || "default";
this.viewScope = opts.viewScope;
this.saveToRecentNotes(resolvedNotePath);
@@ -137,10 +142,6 @@ class NoteContext extends Component {
return;
}
if (resolvedNotePath === this.notePath) {
return;
}
if (await hoistedNoteService.checkNoteAccess(resolvedNotePath, this) === false) {
return; // note is outside of hoisted subtree and user chose not to unhoist
}