How to add a shortcut to my team in CKEditor 3?

My plugin defines a command to insert some data and create a link from it.

Is there any way to make a keyboard shortcut for it? I can not find anything that works.

I can't get this one for work.

Doing this from my plugin definition doesn't work in either

CKEDITOR.config.keystrokes.append([CKEDITOR.CTRL + CKEDITOR.SHIFT + 108, 'pasteLotusLink']); 

Do not try to get at least bold for cq to work:

 editor.keystrokeHandler.keystrokes[CKEDITOR.CTRL + 113, 'bold']; 
+4
source share
1 answer

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 } ); } } ); 
+2
source

Source: https://habr.com/ru/post/1491938/


All Articles