Event for ckeditor content changed

If possible, how can we change the ckeditor event? For example, where the page is open, text has already been added to the ckeditor aka textarea content. Subsequently, I print something else or delete part of this text. Is there some kind of event that quit, can I change the variable when the text changes?

I have this for regular text areas:

$("input,textarea").on("input", function () { booleanvar= true; }); 

Saw a possible solution somewhere who had this:

 $('.ckeditor').ckeditorGet().on('key', function (e) { //some code }); 

I tried, but did not work. And yes, I know that my ckeditor textarea has "ckeditor" as its class, so there is no reason for this not to work.

So, is there something like these examples that I can use to jump to some cceditor event with modified text?

+6
source share
2 answers

Yes, there is a very convenient change , even if you can listen. Documentation here: http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change

Use it, for example, like this (change editor1 to an instance of your editor):

 CKEDITOR.instances.editor1.on('change', function() { console.log("TEST"); }); 
+19
source

It helps me a lot for sharing CKEDITOR .

 <textarea id="ckeditor_textarea " name="ckeditor_textarea ">Add Yore Data</textarea> <script type="text/javascript"> var editor = CKEDITOR.replace( 'ckeditor_textarea ', {}); // editor is object of your CKEDITOR editor.on('change',function(){ console.log("test"); }); </script> 
+1
source

Source: https://habr.com/ru/post/981391/


All Articles