to bind something to an onChange event, one would write something similar to this:
CKEDITOR.on( 'currentInstance', function( ev )
{
if (CKEDITOR.instances[element_id].checkDirty()) {
unsaved_changes = true;
}
});
But… how does one unbind that that function?
The above code is part of some instantiating code that I use when creating an editor. An issue arises when I use ajax to change the page, and the CKEditor (and all other javascript variables) remain defined on the page. So, the onChange event ends up getting multiple bindings… which can cause performance issues.
The eventInfo documentation of CKEditor is missing the "removeListener" method that you can find using Firebug. I’ve added it now but it might take a day until it’s published.
You just have to call that method on the event object, for example: