开发者

CKEditor: How to disable keyboard shortcuts?

开发者 https://www.devze.com 2023-02-15 09:54 出处:网络
Does anyone know how to disable all keyboard shortcuts in CKEdi开发者_高级运维tor 3.4.1? ThanksReplace the CKEditor.config.keystrokes with an empty array:

Does anyone know how to disable all keyboard shortcuts in CKEdi开发者_高级运维tor 3.4.1?

Thanks


Replace the CKEditor.config.keystrokes with an empty array:

CKEDITOR.config.keystrokes = [];

See plugins_keystrokes_plugin.js, line 195.


You can do it this way:

var isCtrl = false;

$('#your_textarea_id').ckeditor(function ()
{

    editor.on( 'contentDom', function( evt )
    {
        editor.document.on( 'keyup', function(event)
        {
            if(event.data.$.keyCode == 17) isCtrl=false;
        });

        editor.document.on( 'keydown', function(event)
        {
            if(event.data.$.keyCode == 17) isCtrl=true;
            if(event.data.$.keyCode == 83 && isCtrl == true)
            {
                //The preventDefault() call prevents the browser's save popup to appear.
                //The try statement fixes a weird IE error.
                try {
                    event.data.$.preventDefault();
                } catch(err) {}

                //Call to your save function

                return false;
            }
        });

    }, editor.element.$);
});

Check out this post for more.

0

精彩评论

暂无评论...
验证码 换一张
取 消