After a morning struggling with it, I finally found the way to do that!
CKeditor already offers a hotkey functionality (see the CKeditor documentation). Using this functionality we can bind keystrokes to CKeditor actions. In order to save, the following line should be added:
[ CKEDITOR.CTRL + 83 /*S*/, 'save' ],
However, this will fire the default CKeditor save command. In my case I need to execute a JS function that sends the CKeditor data along with other stuff via AJAX to the server and leaves the user in the same form (doesn't exit).
After looking at the CKeditor support forums and after some coding, I arrived to the following solution (I use jQuery):
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.$);
});
Tested in Firefox, Chrome and IE8.