Search code examples
javascriptjqueryckeditor

CKEDITOR : Restrict keys using blockedKeystrokes


I have a problem with restricting ALT and WINDOWS keys in my CKEditor.

My Current method is like this

config.blockedKeystrokes =[1114203,18];
//18 ==> ALT 1114203 ==> WINDOWS
         (OR) 
config.blockedKeystrokes =[1114203,CKEDITOR.ALT];

But, those are not working on my end.

What should I do now?

-Thank you


Solution

  • Try this it works in my case :- 4456466 is keycode of alt.

        CKEDITOR.on('instanceCreated', function(e) {
        e.editor.on('key', function (event) {
            console.log(event.data.keyCode);
            if (event.data.keyCode == 4456466) {
                console.log("here");
                event.cancel();
            }
        });
    });