update
This commit is contained in:
11
web_app/src/hooks/useHotkey.tsx
Normal file
11
web_app/src/hooks/useHotkey.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useStore } from "@/lib/states"
|
||||
import { useHotkeys } from "react-hotkeys-hook"
|
||||
|
||||
const useHotKey = (keys: string, callback: any, deps?: any[]) => {
|
||||
const disableShortCuts = useStore((state) => state.disableShortCuts)
|
||||
|
||||
const ref = useHotkeys(keys, callback, { enabled: !disableShortCuts }, deps)
|
||||
return ref
|
||||
}
|
||||
|
||||
export default useHotKey
|
||||
Reference in New Issue
Block a user