# editor/shortcuts

### Members

#### INLINE_SHORTCUTS →Object.<string, string>staticconstant

These shortcut strings are replaced with the corresponding LaTeX expression without requiring an escape sequence or command.

##### Type
• Object.<string, string>

#### KEYBOARD_SHORTCUTS →Object.<string, string>staticconstant

The index of this array is a keystroke combination as returned by the key field of a Javascript keyboard event as documented here: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values except for:

• EscapeEsc
• LeftArrow... → Left/Right/Up/Down
• DeleteDel
• EscapeEsc
• ' ' → Spacebar

The modifiers are specified before the main key, in the following order:

1. Ctrl
2. Meta: Command key on Mac OS. On Windows this is the Windows key, but the system intercepts those key combinations so they are never received
3. Alt: Option key on Mac OS
4. Shift

The keys can be preceded by a context to restrict when the shortcut is applicable. For example, "math:Ctrl-KeyA" will restrict this shortcut to only apply in the "math" context (parseMode). Other valid context include "text" and "command".

The value of the entries represent the command to perform. This can be either a single selector, or an array of a selector followed by its arguments. Selectors uses the following naming conventions:

• a 'char' is a math atom (a letter, digit, symbol or compound atom)
• a 'word' is a sequence of math atoms of the same type
• a 'group' is a sequence of sibling atoms, for example a numerator or a superscript
• the 'MathField' is the entire expression being edited
• a 'placeholder' is either an actual placeholder atom or an empty child list, for example an empty numerator
• 'move' changes the position of the insertion point (and collapses the selection range if necessary)
• 'extend' keeps the anchor of the selection, but moves the focus (extends, or shrinks, the range of selected items)
##### Type
• Object.<string, string>

#### REVERSE_KEYBOARD_SHORTCUTS →Object.<string, string>staticconstant

Most commands can be associated to their keyboard shortcuts from the KEYBOARD_SHORTCUTS table above, for example 'speakSelection' -> 'Ctrl-KeyR' However, those that contain complex commands are more ambiguous. For example, '\sqrt' -> 'math-Alt-KeyV'. This table provides the reverse mapping for those more complex commands. It is used when displaying keyboard shortcuts for specific commands in the popover.

##### Type
• Object.<string, string>

### Methods

#### match(s: string) → stringprivatestatic

This function is used to resolve inline shortcuts.

s string

candidate inline shortcuts (e.g. '2+pi')

string

null if no matching shortcut, the value of the shortcut otherwise

#### matchKeystroke(mode: string, keystroke: string)privatestatic

Return the command matching the keystroke.

mode string
keystroke string

#### platform(p: string) → stringprivatestatic

Return p, the platform name if p is the current platform, otherwise return !p. For example, when running on Windows, platform('mac') returns '!mac'. The valid values for p are:

• 'mac'
• 'win'
• 'android'
• 'ios'
• 'chromeos'
• 'other' (Linux, etc...)
p string

The platform to test against.

string

if we are running on the candidate platform, return it. Otherwise, return "!" + candidate.

#### stringify(shortcuts: Object.<string, string>, join: string)privatestatic

Return a human readable representation of an array of shortcut strings

shortcuts Object.<string, string>
join string

optional, string in between each shortcut representation