Documentation

Shortcut

  1. add

add #

Arguments
keys String
options Object

Adds a keyboard shortcut for the plugin method.

this.app.shortcut.add('ctrl+j, meta+j', {
    command: 'myplugin.toggle',
    params: { arg: 1 }
});

Here is an example of plugin with an assigned shortcut:

ArticleEditor.add('plugin', 'myplugin', {
    start: function() {
        this.app.shortcut.add('ctrl+j, meta+j', {
            command: 'myplugin.toggle',
            params: { arg: 1 }
        });
    },
    toggle: function(params, e) {
        console.log('Shortcut action with a param ' + params.arg);
    }
});