Reputation: 27969
I want to change the Keystrokes config of CKEditor at runtime.
My goal: Ctr+Enter should submit the form.
Unfortunately I can't configure CKEditor via js-configuration, since I use django-ckeditor (related issue #322)
I tried this:
$(function() {
CKEDITOR.on( 'instanceReady', function( evt ) {
for(x in CKEDITOR.instances){
var instance = CKEDITOR.instances[x];
instance.config.Keystrokes.push([ CTRL + 13 /* Enter */, 'Save' ]);
};
})
})
... but I get:
TypeError: instance.config.Keystrokes is undefined
How can I modify the configuration of CKEditor to make ctrl+enter submit the form?
Upvotes: 1
Views: 302
Reputation: 3151
You can use CKEDITOR.editor.setKeystroke like this (note the small 's' in 'save'):
CKEDITOR.on('instanceReady', function(evt) {
evt.editor.setKeystroke(CKEDITOR.CTRL + 13, 'save');
})
Upvotes: 1