1.0.2 • Published 4 months ago
@easy-editor/plugin-hotkey v1.0.2
@easy-editor/plugin-hotkey
Hotkey plugin for EasyEditor.
Default Hotkeys
Action | Shortcut |
---|---|
Undo | ⌘ + Z / Ctrl + Z |
Redo | ⌘ + Y / Ctrl + Y |
Lock/Unlock | ⌘ + Shift + L / Ctrl + Shift + L |
Show/Hide | ⌘ + Shift + H / Ctrl + Shift + H |
Copy | ⌘ + C / Ctrl + C |
Paste | ⌘ + V / Ctrl + V |
Cut | ⌘ + X / Ctrl + X |
Delete | Backspace / Delete |
Clear Selection | Esc |
Customizing Hotkeys
The HotkeyPlugin now supports customizing hotkeys. You can modify the key combinations or disable specific hotkeys entirely.
Example Usage
import { HotkeyPlugin } from '@easy-editor/plugin-hotkey';
HotkeyPlugin({
config: {
// Change the "undo" shortcut to only use Alt+Z
HISTORY_UNDO: {
keys: ['alt+z']
},
// Disable the "show/hide" shortcut
SHOW_HIDE: false,
// Customize "delete" to use only the Delete key
DELETE: {
keys: ['del']
},
// Explicitly enable a shortcut (default is enabled)
COPY: true
}
})
Configuration Options
The configuration object accepts the following hotkey actions (all lowercase):
HISTORY_UNDO
- Undo last actionHISTORY_REDO
- Redo last undone actionLOCK_UNLOCK
- Lock or unlock selected elementsSHOW_HIDE
- Show or hide selected elementsCOPY
- Copy selected elementsPASTE
- Paste copied elementsCUT
- Cut selected elementsDELETE
- Delete selected elementsCLEAR_SELECTION
- Clear the current selection
For each action, you can provide:
- A boolean value:
true
to enable (default),false
to disable - Or an object with:
enabled
(boolean, optional) - Set tofalse
to disable the hotkey, defaults totrue
keys
(string[]) - Array of key combinations to use (replaces default keys)
Key Combination Format
Key combinations should be specified in the format:
- Modifier keys:
ctrl
,alt
,shift
,command
(ormeta
) - Regular keys: letter keys (a-z), number keys (0-9), special keys (
esc
,del
,backspace
, etc.) - Combined with
+
symbol, e.g.,ctrl+s
orcommand+shift+z
1.0.2
4 months ago
1.0.1
4 months ago
1.0.0
5 months ago
0.0.14
5 months ago
0.0.13
7 months ago
0.0.12
7 months ago
0.0.11
7 months ago
0.0.10
7 months ago
0.0.9
7 months ago
0.0.8
7 months ago
0.0.7
7 months ago
0.0.6
8 months ago
0.0.5
8 months ago
0.0.4
8 months ago
0.0.3
8 months ago
0.0.2
8 months ago
0.0.1
8 months ago
0.0.1-alpha.0
8 months ago