KeyboardCommand.onKey method
KeyboardCommand › onKey
The handler invoked when the shortcut is pressed. When omitted, the command is a hint only and no scope handler is registered.Signature:
onKey($event: KeyboardEvent, context: KeymapContext): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | KeyboardEvent | |
| context | KeymapContext | The keymap context. |
Returns: boolean — false to prevent Obsidian's default handling, or void/true otherwise.