Skip to content Skip to sidebar Skip to footer

How Can I Add A Keyboard Shortcut For My Command In Ckeditor 3?

My plugin defines a command to paste some data and generate a link from it. Is there any way to make a keyboard shortcut for it? I can't find anything that works. I cannot get this

Solution 1:

For 4.x, use editor.setKeystroke:

CKEDITOR.plugins.add( 'foo', {
    init: function( editor ) {
        editor.setKeystroke( CKEDITOR.CTRL + 81, 'bold' ); // CTRL+Q
    }
} );

For 3.x:

CKEDITOR.plugins.add( 'foo', {
    init: function( editor ) {
        editor.on( 'instanceReady', function( evt ) {
            evt.removeListener();
            this.keystrokeHandler.keystrokes[ CKEDITOR.CTRL + 81 ] = 'bold'; // CTRL+Q
        } );
    }
} );

Post a Comment for "How Can I Add A Keyboard Shortcut For My Command In Ckeditor 3?"