Add shortcut for plugin

This example shows how to add custom shortcuts for plugin.

Code

<!--element -->
<textarea id="content"></textarea>

<!-- create a plugin -->
<script>
(function($R)
{
    $R.add('plugin', 'savecode', {
        init: function(app)
        {
            this.app = app;
            this.source = app.source;
        },
        save: function()
        {
            var html = this.source.getCode();
            console.log(html);
        }
    });
})(Redactor);
</script>

<!-- call -->
<script>
$R('#content', {
    plugins: ['savecode'],
    shortcutsAdd: {
        'ctrl+s, meta+s': { api: 'plugin.savecode.save' }
    }
});
</script>