ShortcutManager
The ShortcutManager
API allows developers to register keyboard shortcuts for specified actions using JS or TS.
Version compatibility
ShortcutManager
was introduced in version 4.58.0 of the JourneyApps Runtime.Keyboard shortcuts are only supported on Desktop.
This document describes registering and unregistering keyboard shortcuts via JS/TS. For the shortcut
XML components see these docs.
Basic Example
Methods
registerShortcut
Allows developers to register a new keyboard shortcut, and specify the corresponding action (via a callback function). The key combination (keys
parameter) for a shortcut is the shortcut's unique identifier, hence if duplicate shortcuts are registered, only the last registered callback action will execute.
keys
string
"CTRL+K"
Registering shortcuts over multiple views
To have a keyboard shortcut be available globally (i.e. in multiple views of your app), the shortcut should get registered in your app's SharedJS (in a JavaScript app) or App Modules (in a TypeScript app).
Reserved keys
The following keys are reserved and hence cannot be used as keys
:
CTRL+Z
CTRL+SHIFT+Z
CTRL+Y
CTRL+C
CTRL+V
CTRL+R
ESC
ENTER
BACKSPACE
DELETE
unregisterShortcut
Allows developers to unregister a previously registered keyboard shortcut.
keys
string
"CTRL+K"
Last updated