Skip to content

CreateShortcutManager

Members

activeContextName

Source code

createShortcutManager~activeContextName : string

The name of the active ShortcutContext.

CONTEXTS

Source code

createShortcutManager~CONTEXTS : UniqueMap

A unique map that stores keyboard shortcut contexts.

isCtrlKeySilenced

Source code

createShortcutManager~isCtrlKeySilenced : boolean

This variable relates to the captureCtrl shortcut option, which allows for capturing the state of the Control/Meta modifier key. Some of the default keyboard shortcuts related to cell selection need this feature for working properly.

Methods

handleEventWithScope

Source code

createShortcutManager~handleEventWithScope(event) ⇒ boolean

Handle the event with the scope of the active context.

ParamTypeDescription
eventKeyboardEventThe keyboard event.

recorderCallback

Source code

createShortcutManager~recorderCallback(event, keys, context) ⇒ boolean

A callback function for listening events from the recorder.

A context may declare a fallback, so that the keys it does not answer keep working while it is active - an overlay that covers the grid without replacing it, for example. The chain is walked here rather than inside the context, which keeps hasShortcut() and getShortcuts() answering for a single context, as their documentation promises and as hasEventShortcut() needs.

The walk moves on only when NOTHING in the current context ran. A shortcut whose runOnlyIf returned true stops it, whether or not its callback did anything - that is what lets a context claim a key deliberately. A shortcut that is registered but declines (its runOnlyIf returned false) does not shadow the fallback’s answer for the same key, which is the whole point of inheriting rather than listing keys by hand.

ParamTypeDescription
eventKeyboardEventThe keyboard event.
keysArray<string>Names of the shortcut’s keys, (coming from KeyboardEvent.key), in lowercase or uppercase, unified across browsers.
contextobject
string
The context object or name.

runContextShortcuts

Source code

createShortcutManager~runContextShortcuts(event, keys, context) ⇒ Object

Runs every shortcut the given context registers for the pressed keys, without consulting its fallback.

ParamTypeDescription
eventKeyboardEventThe keyboard event.
keysArray<string>Normalized pressed keys.
contextobjectThe context to run.

runGlobalScopedShortcuts

Source code

createShortcutManager~runGlobalScopedShortcuts(event, keys) ⇒ boolean

Runs shortcuts registered on scope: 'global' contexts when the table shortcut pipeline is blocked.

ParamTypeDescription
eventKeyboardEventThe keyboard event.
keysArray<string>Normalized pressed keys.

Returns: boolean - Whether a shortcut canceled further handling.