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.
精彩评论