Overview

The Keymap component observes the keyboard inputs and emits events when they match predefined shortcuts.

Properties

lines

get

Returns the latest Lines instance. This is an alias of Code#Lines.


i18n

get

Returns the i18n collection. This is an alias of this.options.i18n.

Methods

matches()

matches( e: KeyboardEvent, id: string ): boolean

Checks if the keyboard event matches keys of the provided action ID or not.

Params

e

A KeyboardEvent object.

id

An ID.

Return

true if the keyboard event matches keys of the ID, or otherwise false.


getShortcut()

getShortcut( id: string | KeyMatcher ): string

Builds a shortcut string that describes keys of the provided action ID or a KeyMatcher object. For example, undo or [ 'Z', true ] will be Ctrl+Z.

Params

id

An action ID in the keymap or a KeyMatcher object line.

Return

A built shortcut string. If the ID is not available, it returns an empty string.