Creates an instance of the keystroke handler.
Destroys the keystroke handler.
Starts listening for keydown events from a given emitter.
Triggers a keystroke handler for a specified key combination, if such a keystroke was #set defined.
Key event data.
Whether the keystroke was handled.
Registers a handler for the specified keystroke.
The handler can be specified as a command name or a callback.
Keystroke defined in a format accepted by the module:utils/keyboard~parseKeystroke function.
If a string is passed, then the keystroke will
module:core/editor/editor~Editor#execute execute a command.
If a function, then it will be called with the
module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data object and
a cancel() helper to both preventDefault() and stopPropagation() of the event.
Optionaloptions: { priority?: PriorityString }Additional options.
Optional Readonlypriority?: PriorityStringThe priority of the keystroke callback. The higher the priority value the sooner the callback will be executed. Keystrokes having the same priority are called in the order they were added.
Stops listening to keydown events from the given emitter.
Optionalemitter: HTMLElement | Emitter | Window
A keystroke handler for editor editing. Its instance is available in module:core/editor/editor~Editor#keystrokes so plugins can register their keystrokes.
E.g. an undo plugin would do this: