refactor: revert to passing note uuid to selectNote
This commit is contained in:
@@ -119,32 +119,35 @@ export class NotesState {
|
|||||||
}, notesToSelect);
|
}, notesToSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectNote(note: SNNote): Promise<void> {
|
async selectNote(uuid: UuidString): Promise<void> {
|
||||||
if (
|
const note = this.application.findItem(uuid) as SNNote;
|
||||||
this.io.activeModifiers.has(
|
if (note) {
|
||||||
KeyboardModifier.Meta || KeyboardModifier.Ctrl
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
if (this.selectedNotes[note.uuid]) {
|
|
||||||
delete this.selectedNotes[note.uuid];
|
|
||||||
} else if (await this.application.authorizeNoteAccess(note)) {
|
|
||||||
this.selectedNotes[note.uuid] = note;
|
|
||||||
this.lastSelectedNote = note;
|
|
||||||
}
|
|
||||||
} else if (this.io.activeModifiers.has(KeyboardModifier.Shift)) {
|
|
||||||
await this.selectNotesRange(note);
|
|
||||||
} else {
|
|
||||||
const shouldSelectNote =
|
|
||||||
this.selectedNotesCount > 1 || !this.selectedNotes[note.uuid];
|
|
||||||
if (
|
if (
|
||||||
shouldSelectNote &&
|
this.io.activeModifiers.has(
|
||||||
(await this.application.authorizeNoteAccess(note))
|
KeyboardModifier.Meta || KeyboardModifier.Ctrl
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
this.selectedNotes = {
|
if (this.selectedNotes[note.uuid]) {
|
||||||
[note.uuid]: note,
|
delete this.selectedNotes[note.uuid];
|
||||||
};
|
} else if (await this.application.authorizeNoteAccess(note)) {
|
||||||
await this.openEditor(note.uuid);
|
this.selectedNotes[note.uuid] = note;
|
||||||
this.lastSelectedNote = note;
|
this.lastSelectedNote = note;
|
||||||
|
}
|
||||||
|
} else if (this.io.activeModifiers.has(KeyboardModifier.Shift)) {
|
||||||
|
await this.selectNotesRange(note);
|
||||||
|
} else {
|
||||||
|
const shouldSelectNote =
|
||||||
|
this.selectedNotesCount > 1 || !this.selectedNotes[note.uuid];
|
||||||
|
if (
|
||||||
|
shouldSelectNote &&
|
||||||
|
(await this.application.authorizeNoteAccess(note))
|
||||||
|
) {
|
||||||
|
this.selectedNotes = {
|
||||||
|
[note.uuid]: note,
|
||||||
|
};
|
||||||
|
await this.openEditor(note.uuid);
|
||||||
|
this.lastSelectedNote = note;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user