fix: if multiples notes selected, always select note when clicking on it
This commit is contained in:
@@ -51,7 +51,7 @@ export const NotesOptionsPanel = observer(({ appState }: Props) => {
|
|||||||
onBlur={closeOnBlur}
|
onBlur={closeOnBlur}
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
className={
|
className={
|
||||||
'bg-transparent border-solid border-1 border-neutral ' +
|
'sn-button outlined ' +
|
||||||
'cursor-pointer w-32px h-32px rounded-full p-0 ' +
|
'cursor-pointer w-32px h-32px rounded-full p-0 ' +
|
||||||
'flex justify-center items-center'
|
'flex justify-center items-center'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,9 +100,8 @@ export class NotesState {
|
|||||||
note.protected && this.application.hasProtectionSources();
|
note.protected && this.application.hasProtectionSources();
|
||||||
if (requestAccess) {
|
if (requestAccess) {
|
||||||
if (!protectedNotesAccessRequest) {
|
if (!protectedNotesAccessRequest) {
|
||||||
protectedNotesAccessRequest = this.application.authorizeNoteAccess(
|
protectedNotesAccessRequest =
|
||||||
note
|
this.application.authorizeNoteAccess(note);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!requestAccess || (await protectedNotesAccessRequest)) {
|
if (!requestAccess || (await protectedNotesAccessRequest)) {
|
||||||
@@ -129,8 +128,10 @@ export class NotesState {
|
|||||||
} else if (this.io.activeModifiers.has(KeyboardModifier.Shift)) {
|
} else if (this.io.activeModifiers.has(KeyboardModifier.Shift)) {
|
||||||
await this.selectNotesRange(note);
|
await this.selectNotesRange(note);
|
||||||
} else {
|
} else {
|
||||||
|
const shouldSelectNote =
|
||||||
|
this.selectedNotesCount > 1 || !this.selectedNotes[note.uuid];
|
||||||
if (
|
if (
|
||||||
!this.selectedNotes[note.uuid] &&
|
shouldSelectNote &&
|
||||||
(await this.application.authorizeNoteAccess(note))
|
(await this.application.authorizeNoteAccess(note))
|
||||||
) {
|
) {
|
||||||
this.selectedNotes = {
|
this.selectedNotes = {
|
||||||
@@ -183,25 +184,21 @@ export class NotesState {
|
|||||||
await this.application.changeItems(
|
await this.application.changeItems(
|
||||||
Object.keys(this.selectedNotes),
|
Object.keys(this.selectedNotes),
|
||||||
mutate,
|
mutate,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
this.application.sync();
|
this.application.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
setHideSelectedNotePreviews(hide: boolean): void {
|
setHideSelectedNotePreviews(hide: boolean): void {
|
||||||
this.changeSelectedNotes(
|
this.changeSelectedNotes((mutator) => {
|
||||||
(mutator) => {
|
mutator.hidePreview = hide;
|
||||||
mutator.hidePreview = hide;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setLockSelectedNotes(lock: boolean): void {
|
setLockSelectedNotes(lock: boolean): void {
|
||||||
this.changeSelectedNotes(
|
this.changeSelectedNotes((mutator) => {
|
||||||
(mutator) => {
|
mutator.locked = lock;
|
||||||
mutator.locked = lock;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setTrashSelectedNotes(trashed: boolean): Promise<void> {
|
async setTrashSelectedNotes(trashed: boolean): Promise<void> {
|
||||||
@@ -214,11 +211,9 @@ export class NotesState {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.changeSelectedNotes(
|
this.changeSelectedNotes((mutator) => {
|
||||||
(mutator) => {
|
mutator.trashed = trashed;
|
||||||
mutator.trashed = trashed;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
this.unselectNotes();
|
this.unselectNotes();
|
||||||
this.contextMenuOpen = false;
|
this.contextMenuOpen = false;
|
||||||
}
|
}
|
||||||
@@ -263,11 +258,9 @@ export class NotesState {
|
|||||||
await this.application.deleteItem(note);
|
await this.application.deleteItem(note);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.changeSelectedNotes(
|
this.changeSelectedNotes((mutator) => {
|
||||||
(mutator) => {
|
mutator.trashed = true;
|
||||||
mutator.trashed = true;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -276,11 +269,9 @@ export class NotesState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setPinSelectedNotes(pinned: boolean): void {
|
setPinSelectedNotes(pinned: boolean): void {
|
||||||
this.changeSelectedNotes(
|
this.changeSelectedNotes((mutator) => {
|
||||||
(mutator) => {
|
mutator.pinned = pinned;
|
||||||
mutator.pinned = pinned;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setArchiveSelectedNotes(archived: boolean): Promise<void> {
|
async setArchiveSelectedNotes(archived: boolean): Promise<void> {
|
||||||
@@ -291,11 +282,9 @@ export class NotesState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.changeSelectedNotes(
|
this.changeSelectedNotes((mutator) => {
|
||||||
(mutator) => {
|
mutator.archived = archived;
|
||||||
mutator.archived = archived;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.selectedNotes = {};
|
this.selectedNotes = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user