Loading...
Implementing a Hook for Canvas Keyboard Shortcuts
useKeyboard('ctrl+c', () => { ... });
Here is a simple example of using useKeyboard:
Ctrl + C to copy a node
Ctrl + V to paste a node
useKeyboard(key: string | string[],callback: (e) => void,action?: 'keypress' | 'keydown' | 'keyup')
None
| Parameter | Description | Type | Default Value |
|---|---|---|---|
| key | The shortcut key to bind | string | string[] | - |
| callback | The callback to execute on the shortcut key | (e: KeyboardEvent) => void | - |
| action | The trigger type | keypress | keydown | keyup | - |