fix: better protected notes handling and allow shift-clicking note up in the list

This commit is contained in:
Antonella Sgarlatta
2021-05-07 16:57:25 -03:00
parent b89cdde1fc
commit 6a6e1708d6
2 changed files with 60 additions and 31 deletions

View File

@@ -298,10 +298,12 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
));
}
private openNotesContextMenu(e: MouseEvent, note: SNNote) {
private async openNotesContextMenu(e: MouseEvent, note: SNNote) {
e.preventDefault();
this.selectNote(note);
if (!note.protected) {
if (!this.state.selectedNotes[note.uuid]) {
await this.selectNote(note);
}
if (this.state.selectedNotes[note.uuid]) {
this.application.getAppState().notes.setContextMenuPosition({
top: e.clientY,
left: e.clientX,
@@ -330,8 +332,8 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesCtrlState> {
}
for (const note of this.state.renderedNotes) {
if (!this.rightClickListeners.has(note.uuid)) {
const listener = (e: MouseEvent): void => {
return this.openNotesContextMenu(e, note);
const listener = async (e: MouseEvent): Promise<void> => {
return await this.openNotesContextMenu(e, note);
};
document
.getElementById(`note-${note.uuid}`)