How to customize keyboard shortcuts in CK EDITOR 4. Not find plugin for Keystrocks

I want to disable some key in CK EDITOR.

I am using CKEDITOR 4.0 and I want to disable some keyboard shortcuts in CKEDITOR.

eg. help file opens on Alt + 0

In the old version Config Available in Source / plugins / keystroks / plugins.js But not available in the new version.

+4
source share
3 answers

Using config.keystrokes , you can add and remove keystrokes.

From the documentation:

 // Disable default CTRL + L keystroke which executes link command by default. config.keystrokes = [ ... [ CKEDITOR.CTRL + 76, null ], // CTRL + L ... ]; 
+4
source

Replace CKEditor.config.keystrokes with an empty array:

 CKEDITOR.config.keystrokes = []; 

Or CKeditor already offers hotkey functionality (see the CKeditor documentation). Using this functionality, we can bind keystrokes to CKeditor actions. To save, add the following line:

CKEDITOR.config.keystrokes = ... [ CKEDITOR.CTRL + 83 /*S*/, null ], ...

+3
source

I see that you have comments on both answers that talk about applying changes to all CKEditor instances. The following code should allow you to override settings for all instances

 window.onload = function(){ CKEDITOR.on('instanceReady', function (ev) { ev.editor.setKeystroke(CKEDITOR.ALT + 48 /*0*/, false); }); } 

Each time a CKEDITOR instance is initialized and ready, it automatically disables alt + 0.

There is a list of ascii codes for different characters here for reference if you want to disable other keys: http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters

Use the number in the Dec column (decimal) to disable them in the Glyph column.

+1
source

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


All Articles