1.0.2 • Published 10 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:
trueto enable (default),falseto disable - Or an object with:
enabled(boolean, optional) - Set tofalseto disable the hotkey, defaults totruekeys(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+sorcommand+shift+z
1.0.2
10 months ago
1.0.1
10 months ago
1.0.0
10 months ago
0.0.14
11 months ago
0.0.13
12 months ago
0.0.12
12 months ago
0.0.11
12 months ago
0.0.10
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago
0.0.1-alpha.0
1 year ago