Documentation / API Reference

Hotkeys

add #

Arguments
keys String
options Object

Adds a keyboard shortcut for the plugin method.


this.app.hotkeys.add('ctrl+j, meta+j', {
    title: 'Toggle my plugin',
    name: 'meta+j',
    command: 'myplugin.toggle',
    params: { arg: 1 }
});

Here is an example of plugin with an assigned shortcut:


Redactor.add('plugin', 'myplugin', {
    start() {
        this.app.hotkeys.add('ctrl+j, meta+j', {
            title: 'Toggle my plugin',
            name: 'meta+j',
            command: 'myplugin.toggle',
            params: { arg: 1 }
        });
    },
    toggle(params, e) {
        console.log('Shortcut action with a param ' + params.arg);
    }
});