@lexical/extension/KeyboardShortcutsExtension
Interfaces
FormatKeyboardShortcutOptions
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:30
Properties
isApple?
optionalisApple?:boolean
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:32
Override the platform convention (defaults to the runtime platform)
separator?
optionalseparator?:string
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:34
The separator between segments (default '+')
KeyboardShortcutsConfig
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:148
Configuration for KeyboardShortcutsExtension.
Experiemental
Properties
disabled
disabled:
boolean
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:150
When true, the shortcut listener is not registered
priority
priority:
CommandListenerPriority|CommandListenerPriorityBefore
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:167
The KEY_DOWN_COMMAND priority (default COMMAND_PRIORITY_NORMAL).
This must be a priority above COMMAND_PRIORITY_EDITOR. Every
editor registers the core $handleKeyDown at
COMMAND_PRIORITY_EDITOR and it unconditionally reports the event
as handled, so a shortcut listener at that priority or later is never
reached. That also rules out
COMMAND_PRIORITY_BEFORE_EDITOR: command dispatch walks priorities
from COMMAND_PRIORITY_CRITICAL down to
COMMAND_PRIORITY_EDITOR on the outside and the nested editor
chain on the inside, so a nested editor's own $handleKeyDown ends the
dispatch before any listener the parent has in the editor-priority queue —
which would make KeyboardShortcut.bubbleFromNestedEditors
impossible to satisfy.
shortcuts
shortcuts:
NamedKeyboardShortcuts
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:169
The named shortcut table, merged by name across the extension graph
Type Aliases
NamedKeyboardShortcuts
NamedKeyboardShortcuts =
Record<string,KeyboardShortcut| readonlyKeyboardShortcut[] |null>
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:139
Experimental
Keyboard shortcuts by name. The names exist so that other extensions and applications can overlay the table: configuring an existing name remaps that shortcut, configuring it to null disables it, and new names add new shortcuts.
Variables
KeyboardShortcutsExtension
constKeyboardShortcutsExtension:LexicalExtension<KeyboardShortcutsConfig,"@lexical/extension/KeyboardShortcuts",NamedSignalsOutput<KeyboardShortcutsConfig>,unknown>
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:274
Experimental
Dispatches a table of keyboard shortcuts from a single compiled
KEY_DOWN_COMMAND listener, in O(1) per keypress.
The table is merged across the whole extension graph by name: any
extension or app config can add shortcuts under new names, remap an
existing name to a different key or handler, or disable one by
configuring it to null. The output exposes the config as signals, so the
table can also be remapped at runtime through the shortcuts signal
(the listener is recompiled on change).
Configuring an existing name always replaces its mapping outright, and a name may be mapped to an array to give it several bindings at once. The overriding names are also matched first, ahead of the names they did not override, when more than one shortcut matches the same keypress.
Functions
formatKeyboardShortcut()
formatKeyboardShortcut(
shortcut,options?):string[]
Defined in: packages/lexical-extension/src/KeyboardShortcutsExtension.ts:97
Format the key binding of a shortcut as a human readable string for
menus, tooltips, and help dialogs (e.g. '⌘+Shift+K' on Apple platforms
and 'Ctrl+Shift+K' elsewhere). Modifiers with an 'any' mask are not
displayed.
Parameters
shortcut
options?
FormatKeyboardShortcutOptions = {}
Returns
string[]