blockly > ShortcutRegistry

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

static

readonly

ShortcutRegistry

Methods

Method Modifiers Description
addKeyMapping(keyCode, shortcutName, opt_allowCollision) Adds a mapping between a keycode and a keyboard shortcut.
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.
register(shortcut, opt_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, opt_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 key code. This will also remove any key mappings that reference this shortcut.