CKEditor keyboard shortcuts

Bloomreach Content-specific keyboard shortcuts

  • Ctrl + M
    Maximize the editor (i.e. 'full screen' mode)

  • Alt + B
    Toggle 'show borders of block elements'

Configuration

A keyboard shortcut executes a named command defined by a CKEditor toolbar item. All keyboard shortcuts are defined in the CKEditor configuration property 'keystrokes'. A keystroke can be combination of Control, Alt, Shift and individual keys.

To add a keystroke, use the HTML field configuration property ' ckeditor.config.appended.json' to add keystrokes to the CEditor configuration property 'keystrokes'. For example, to insert a new table with the command 'table' when pressing Control + Alt + T:

ckeditor.config.appended.json:

{
  keystrokes: [
    [ 'Ctrl', 'Alt', 'T', 'table' ]
  ]
}

The following key names can be used:

  • 'Ctrl', 'Alt', and 'Shift'
  • 'F1' to 'F12' for function keys
  • single-character strings for all other characters

Key names are not case-sensitive.

Background: declarative and numeric keystrokes 

Bloomreach Content supports two types of keystrokes:  declarative and numeric.

  • Declarative keystrokes consist of an array of strings. Each string except the last one represents a key in the keystroke. The last string specifies the command to execute. This format is Bloomreach Content-specific.
  • Numeric keystrokes consist of an array of two element: a number that represents the keys of the keystroke, and a string that specifies the command to execute. This is the format used by CKEditor itself.

Declarative keystrokes are converted to numeric keystrokes when a CKEditor instance is created.

When declarative keystrokes do not work for some reason, numeric keystrokes can be used instead. It requires the calculation of the keystroke number, which is the addition of the decimal value of each key in the keystroke. The decimal value of keys is as follows:

  • Number and symbols: their ASCII code
  • Letters: the ASCII code of the uppercase letter (e.g. 65 for the letter 'A'; 97 for 'a' will not work)
  • Function keys F1 t/m F12: 112 t/m 123
  • Control: 1114112 (0x110000)
  • Shift: 2228224 (0x220000)
  • Alt: 4456448 (0x440000) 

For example, the number of the keystroke 'Control + Alt + T' is 1114112 + 4456448 + 84 = 5570644. The declarative keystroke [ 'Ctrl', 'Alt', 'T', 'help' ] therefore has the numeric format [ 5570644, 'help' ]. The former is just easier to enter.