From 49e54cd41b524d2821b683520d36edfa546b5295 Mon Sep 17 00:00:00 2001 From: Blankeos Date: Fri, 4 Oct 2024 23:23:17 +0800 Subject: [PATCH] docs: Added docs to useHotkeys. --- src/use-hotkeys/use-hotkeys.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/use-hotkeys/use-hotkeys.ts b/src/use-hotkeys/use-hotkeys.ts index c98834f..642fe2d 100644 --- a/src/use-hotkeys/use-hotkeys.ts +++ b/src/use-hotkeys/use-hotkeys.ts @@ -122,6 +122,13 @@ function shouldFireEvent( return true } +/** + * A hook that listens to keyboard events and triggers a callback when a hotkey is pressed. + * + * @param hotkeys - An array of hotkey combinations and callbacks. + * @param tagsToIgnore - An array of HTML tag names to ignore when listening for hotkeys. + * @param triggerOnContentEditable - Whether to trigger the callback when the hotkey is pressed on a contenteditable element. + */ export function useHotkeys( hotkeys: HotkeyItem[], tagsToIgnore: string[] = ['INPUT', 'TEXTAREA', 'SELECT'],