Shortcuts

Redactor maps keyboard combinations to editor commands. Users can open the shortcut list from the Hotkeys button in the extrabar (if enabled).

For full option reference, see Keyboard and tab.

Default shortcuts#

In config, meta means Cmd on Mac and is paired with Ctrl on Windows. Each binding registers both platforms in one key:

'ctrl+b, meta+b': { command: 'inline.set', params: { tag: 'b' }, /* … */ }
Action Windows Mac
Select all Ctrl+A ⌘A
Select all blocks Ctrl+Shift+A ⌘⇧A
Undo Ctrl+Z ⌘Z
Redo Ctrl+Shift+Z ⌘⇧Z
Duplicate block Ctrl+Shift+D ⌘⇧D
Move block up Ctrl+Shift+↑ ⌘⇧↑
Move block down Ctrl+Shift+↓ ⌘⇧↓
Clear inline formatting Ctrl+Shift+M ⌘⇧M
Bold Ctrl+B ⌘B
Italic Ctrl+I ⌘I
Strikethrough Ctrl+Shift+S ⌘⇧S
Underline Ctrl+U ⌘U
Superscript Ctrl+H ⌘H
Subscript Ctrl+L ⌘L
Paragraph Ctrl+Alt+0 ⌘⌥0
Heading 1 Ctrl+Alt+1 ⌘⌥1
Heading 2 Ctrl+Alt+2 ⌘⌥2
Heading 3 Ctrl+Alt+3 ⌘⌥3
Heading 4 Ctrl+Alt+4 ⌘⌥4
Heading 5 Ctrl+Alt+5 ⌘⌥5
Heading 6 Ctrl+Alt+6 ⌘⌥6
Numbered list Ctrl+Shift+7 ⌘⇧7
Bullet list Ctrl+Shift+8 ⌘⇧8
Indent list Ctrl+] ⌘]
Outdent list Ctrl+[ ⌘[
Link Ctrl+K ⌘K

Hotkey entry shape#

Each item in the hotkeys map:

Field Description
title Label in the shortcuts popup
name Display string (meta → ⌘ or Ctrl in the UI)
command Command for app.invoke() (e.g. 'inline.set', 'block.duplicate')
params Optional arguments for the command

Combo keys use + (e.g. meta+shift+b). Modifiers: ctrl, meta, alt, shift. Separate Windows and Mac with a comma in the map key:

'ctrl+shift+h, meta+shift+h': { /* one binding, two platforms */ }

Add a shortcut#

At init — hotkeysAdd

Keeps all defaults and merges your bindings:

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

Replace or extend — hotkeys

Pass a full map to override defaults, or add entries alongside defaults via merge in your build step. Usually hotkeysAdd is simpler.

At runtime — app.hotkeys.add

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

Remove a shortcut#

At init — hotkeysRemove

Pass combo strings exactly as in the default map (including comma-separated Win/Mac form):

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

Removing bold/italic/underline also re-enables the browser’s native Ctrl/Cmd+B/I/U for that tag.

At runtime — app.hotkeys.remove

app.hotkeys.remove('ctrl+b, meta+b');
app.hotkeys.remove('ctrl+k, meta+k');

Disable shortcuts entirely#

Set hotkeys to false:

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

No command shortcuts are handled. Native browser bold/italic/underline are still blocked in the editor so they do not conflict with content editing.

To hide the reference button as well:

extrabar: {
    hide: ['hotkeys']
}

Or remove hotkeys from buttons.extrabar.

Shortcuts in a plugin#

Register in start() after the editor is ready:

class GreetingShortcutPlugin {
    start() {
        this.app.toolbar.add('greetingShortcut', {
            title: 'Insert greeting',
            command: 'greetingShortcut.insert',
            position: { after: 'add' }
        });

        this.app.hotkeys.add('ctrl+shift+g, meta+shift+g', {
            title: 'Insert greeting',
            name: 'meta+shift+g',
            command: 'greetingShortcut.insert'
        });
    }

    insert() {
        const inserter = this.app.getService('inserter');
        inserter.insertHtml('<p>Hello from shortcut!</p>', { caret: 'end' });
    }
}

Redactor.addPlugin('greetingShortcut', GreetingShortcutPlugin);

The command must match a method on the plugin instance (greetingShortcut.insert → app.greetingShortcut.insert()).

Show shortcuts in menus#

Dropdown items can display the bound shortcut automatically when a unique hotkey exists for their command:

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

Buttons may also set a shortcut field manually in button config.