Keyboard & tab

enterKey#

Type: boolean | 'br'

Default: true

Controls Enter key behavior in editable blocks.

  • true — Enter creates a new block; Shift+Enter inserts a line break (<br>)
  • 'br' — Enter inserts a line break; Shift+Enter inserts a line break too
  • false — built-in Enter handling is disabled
const app = Redactor('#entry', {
  enterKey: 'br'
});

tabindex#

Type: false | number | string

Default: false

Sets tabindex on the editable element, so the editor can be reached by keyboard navigation (Tab key).

const app = Redactor('#entry', {
  tabindex: 1
});

tab.key#

Type: boolean

Default: true

Enables Redactor’s Tab key handler. When false, Tab is not intercepted and the browser uses its default focus navigation.

const app = Redactor('#entry', {
  tab: {
    key: false
  }
});

tab.spaces#

Type: boolean | number

Default: true

Controls what Tab inserts inside <pre> blocks.

  • true — inserts 2 spaces
  • number — inserts that many spaces (e.g. 4)
  • false — inserts a literal tab character (\t)

Outside <pre>, this option does not apply. In normal editable blocks, Tab either moves focus (see tab.editableSpaces) or indents lists / moves between table cells.

const app = Redactor('#entry', {
  tab: {
    spaces: 4
  }
});

tab.editableSpaces#

Type: false | boolean | number

Default: false

Controls Tab inside regular editable blocks (not <pre>).

  • false — Tab moves focus to the next block (or the next table cell). Shift+Tab outdents list items or moves to the previous cell.
  • true — inserts 2 non-breaking spaces (&nbsp;) at the caret
  • number — inserts that many non-breaking spaces

When editableSpaces is enabled, Tab no longer jumps to the next block — it always inserts spaces instead.

const app = Redactor('#entry', {
  tab: {
    editableSpaces: 4
  }
});

hotkeys#

Type: false | object

Default: built-in command map (undo, redo, bold, headings, lists, link, and more)

Maps keyboard combinations to editor commands. Each entry key is a combo string (comma-separated alternatives for Ctrl vs Cmd). The value is a command descriptor:

Field Description
title Label in the shortcuts popup (i18n key or plain text)
name Shortcut display string (meta is shown as ⌘ / Ctrl)
command Command name passed to app.invoke()
params Optional command parameters

Set to false to disable all command hotkeys. Browser defaults for bold/italic are still suppressed so they do not fight the editor.

const app = Redactor('#entry', {
  hotkeys: {
    'ctrl+shift+h, meta+shift+h': {
      title: 'Highlight',
      name: 'meta+shift+h',
      command: 'inline.set',
      params: { tag: 'mark' }
    }
  }
});

At runtime use app.hotkeys.add(keys, obj) to register more bindings.

hotkeysAdd#

Type: false | object

Default: false

Adds or overrides entries in the hotkeys map at startup. Same shape as hotkeys values. Merged into hotkeys before shortcuts are registered.

const app = Redactor('#entry', {
  hotkeysAdd: {
    'ctrl+shift+h, meta+shift+h': {
      title: 'Highlight',
      name: 'meta+shift+h',
      command: 'inline.set',
      params: { tag: 'mark' }
    }
  }
});

hotkeysRemove#

Type: false | string[]

Default: false

Removes command shortcuts from the hotkeys map at startup. Pass an array of combo strings exactly as they appear in the default map.

const app = Redactor('#entry', {
  hotkeysRemove: ['ctrl+shift+s, meta+shift+s', 'ctrl+u, meta+u']
});

At runtime use app.hotkeys.remove('ctrl+u, meta+u') to drop command bindings the same way.