Hotkeys

Hotkey registration and dispatch.

Access:

app.hotkeys
app.getModule('hotkeys')
app.invoke('hotkeys.method', …)

add#

Registers a hotkey combo mapped to a command.

Parameters:

  • keys (Array) — rule keys or hotkey names
  • obj (any) — observer field config object
app.hotkeys.add('meta+b', { command: 'inline.set', params: { tag: 'b' } });

remove#

Removes one or more hotkey bindings.

Parameters:

  • ...keys (Array) — rule keys or hotkey names
app.hotkeys.remove('meta+b');

getShortcutForCommand#

Returns display shortcut HTML for a command if uniquely mapped.

Parameters:

  • command (string) — command string (module.method)
  • params (object) — command or form parameters

Returns: string

app.hotkeys.getShortcutForCommand('inline.set', { tag: 'b' });

open#

Opens hotkeys reference dropdown listing bindings.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
app.hotkeys.open({}, { button });

isHandled#

Dispatches matching hotkey and returns whether it was handled.

Parameters:

  • e (Event) — native DOM event

Returns: boolean

app.hotkeys.isHandled(event);