Add Escape to shortcut to deselect replaceContainer

This commit is contained in:
Eric NGUYEN 2023-02-14 16:10:00 +01:00
parent b4c9c34403
commit 2d1e5c94d7
2 changed files with 98 additions and 69 deletions

View file

@ -7,7 +7,8 @@ export function OnKey(
history: IHistoryState[],
historyCurrentStep: number,
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
deleteAction: () => void
deleteAction: () => void,
resetState: () => void
): void {
if (!ENABLE_SHORTCUTS) {
return;
@ -27,5 +28,7 @@ export function OnKey(
setHistoryCurrentStep(historyCurrentStep + 1);
} else if (event.key === 'Delete') {
deleteAction();
} else if (event.key === 'Escape') {
resetState();
}
}