Reputation: 69
I really need some help, I can't figure out how to handle keypress/keydown events. I've already tried everything and looked into javascript API documentation and here on forum but I couldn't find any solution.
Can someone please explain the right way to do that? So my question is... how do I get key events working ?
Upvotes: 1
Views: 1104
Reputation: 1
CKEDITOR.replace("Instance_Name");
// Function for keypress/keyup:-
CKEDITOR.instances['Instance_Name'].on("instanceReady", function (event) {
this.document.on("keyup", function (event) {
var inputText = CKEDITOR.instances.Instance_Name.getData();
console.log(inputText);
});
});
Upvotes: 0
Reputation: 3401
The easiest way is to listen to editor#key
event. Just like so:
var editor = CKEDITOR.instances.editor1;
editor.on( 'key', function( evt ) { console.log( evt ); } );
Upvotes: 1