Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event for ckeditor content changed

If possible, how can we to the event of ckeditor's content being changed? For instance, there's some text already inserted into the ckeditor's content aka textarea when the page is opened. Afterwards I type something more or delete some of that text. Is there some event that's fired I can get to to change a variable when the text is changed?

I have this for regular textareas:

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

Saw a possible solution somewhere that had this:

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

Tried it, but didn't work. And yes I know my ckeditor's textarea has "ckeditor" as its class so that's not the reason for it not to work.

So something like those examples I can use to get to some sort of textchanged event of ckeditor?

like image 379
Micael Florêncio Avatar asked Jan 22 '15 10:01

Micael Florêncio


People also ask

What is CKEditor replace?

The CKEditor 4 Find and Replace feature allows for finding and replacing any text in the editor easily. It helps the user find words, word parts or phrases matching the case of the searched text, which is especially helpful in lengthy documents and one that may utilize certain words in different contexts.

Is CKEditor responsive?

The Bootstrap Visibility plugin for CKEditor extends several dialog windows adding a "Responsive Visibility" tab that allows you to control if various elements should be displayed on different screen sizes.

How do you hide and show CKEditor?

visibility = 'hidden';"+ ""+ "}" + "}" + "}"; This still works in hiding the DIV and in version 2.6 it would also appear to be hidden but in 3.0 the editor is still very much visible.


1 Answers

Yes, there is the very handy change even that you can listen to. Documentation here: http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change

Use it for example like so (change editor1 to your editor instance):

CKEDITOR.instances.editor1.on('change', function() { 
    console.log("TEST");
});
like image 130
Joel Peltonen Avatar answered Sep 20 '22 07:09

Joel Peltonen