javascript - How to get the contents of ckeditor on change? -
i have following code detecting changes on ckeditor surface.
ckeditor.instances['editor1'].on("instanceready", function(){ this.document.on("keyup", function(){ console.log("sth changed"); }); }); i contents of editor on change counting words in it. how can reach using ckeditor.instances?
the only correct way retrieve contents of editor is:
ckeditor.instances.yourinstancename.getdata(); you can try this.on( 'key', function() { ... } ); because editor fires key events.
additionally recommend the ticket regarding onchange event , monitoring changes in editor.
and last not least: the wordcount plugin has been implemented , job ;)
Comments
Post a Comment