Fix keyboard shortcuts not working after selecting (#2756)

* Fix keyboard shortcuts not working after selecting
This commit is contained in:
WithoutPants
2022-07-22 17:25:48 +10:00
committed by GitHub
parent e532f9a683
commit db3138b33f
3 changed files with 13 additions and 12 deletions

View File

@@ -47,24 +47,23 @@ export const ListOperationButtons: React.FC<IListOperationButtonsProps> = ({
Mousetrap.bind("s a", () => onSelectAll?.());
Mousetrap.bind("s n", () => onSelectNone?.());
if (itemsSelected) {
Mousetrap.bind("e", () => {
Mousetrap.bind("e", () => {
if (itemsSelected) {
onEdit?.();
});
}
});
Mousetrap.bind("d d", () => {
Mousetrap.bind("d d", () => {
if (itemsSelected) {
onDelete?.();
});
}
}
});
return () => {
Mousetrap.unbind("s a");
Mousetrap.unbind("s n");
if (itemsSelected) {
Mousetrap.unbind("e");
Mousetrap.unbind("d d");
}
Mousetrap.unbind("e");
Mousetrap.unbind("d d");
};
});