diff --git a/src/common/Shortcuts/Shortcuts.tsx b/src/common/Shortcuts/Shortcuts.tsx index 96b8ffba3..c9198a857 100644 --- a/src/common/Shortcuts/Shortcuts.tsx +++ b/src/common/Shortcuts/Shortcuts.tsx @@ -19,20 +19,10 @@ type Props = { onShortcut: (name: ShortcutName) => void, }; -const REPEAT_THROTTLE_MS = 200; - const ShortcutsProvider = ({ children, onShortcut }: Props) => { const listeners = useRef>>(new Map()); - const lastRepeatTime = useRef>(new Map()); - - const onKeyDown = useCallback(({ ctrlKey, shiftKey, code, key, repeat }: KeyboardEvent) => { - if (repeat) { - const now = Date.now(); - const last = lastRepeatTime.current.get(code) ?? 0; - if (now - last < REPEAT_THROTTLE_MS) return; - lastRepeatTime.current.set(code, now); - } + const onKeyDown = useCallback(({ ctrlKey, shiftKey, code, key }: KeyboardEvent) => { SHORTCUTS.forEach(({ name, combos }) => combos.forEach((keys) => { const modifers = (keys.includes('Ctrl') ? ctrlKey : true) && (keys.includes('Shift') ? shiftKey : true);