ShortcutRegistry class
Class for the registry of keyboard shortcuts. This is intended to be a singleton. You should not create a new instance, and only access this class from ShortcutRegistry.registry.
Signature:
export declare class ShortcutRegistry
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| registry |
|
ShortcutRegistry |
Methods
| Method | Modifiers | Description |
|---|---|---|
| addKeyMapping(keyCode, shortcutName, allowCollision) | Adds a mapping between a keycode and a keyboard shortcut. Normally only one shortcut can be mapped to any given keycode, but setting allowCollisions to true allows a keyboard to be mapped to multiple shortcuts. In that case, when onKeyDown is called with the given keystroke, it will process the mapped shortcuts in reverse order, from the most- to least-recently mapped). |
|
| createSerializedKey(keyCode, modifiers) | Creates the serialized key code that will be used in the key map. | |
| getKeyCodesByShortcutName(shortcutName) | Gets the serialized key codes that the shortcut with the given name is registered under. | |
| getKeyMap() | Gets the current key map. | |
| getRegistry() | Gets the registry of keyboard shortcuts. | |
| getShortcutNamesByKeyCode(keyCode) | Gets the shortcuts registered to the given key code. | |
| onKeyDown(workspace, e) | Handles key down events. - Any |
|
| register(shortcut, allowOverrides) | Registers a keyboard shortcut. | |
| removeAllKeyMappings(shortcutName) | Removes all the key mappings for a shortcut with the given name. Useful when changing the default key mappings and the key codes registered to the shortcut are unknown. | |
| removeKeyMapping(keyCode, shortcutName, quiet) | Removes a mapping between a keycode and a keyboard shortcut. | |
| reset() | Clear and recreate the registry and keyMap. | |
| setKeyMap(newKeyMap) | Sets the key map. Setting the key map will override any default key mappings. | |
| unregister(shortcutName) | Unregisters a keyboard shortcut registered with the given name. This will also remove any key mappings that reference this shortcut. |