I have a custom-written CMS that uses CKEditor *(FCKEditor v3) for editing content. I\'m also using the jQuery Validation plugin to check a
I solved this problem with the current version: http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js
After line 55 this.submit( function( event ) { - i added this code:
if (typeof CKEDITOR !== "undefined") {
for ( instance in CKEDITOR.instances )
CKEDITOR.instances[instance].updateElement();
}
I took a slightly different approach I figured it would be better to use ckeditor's update function and since keyup was being used the timeout wasn't needed
CKEDITOR.instances["editor1"].on("instanceReady", function()
{
//set keyup event
this.document.on("keyup", CK_jQ);
//and paste event
this.document.on("paste", CK_jQ);
}
function CK_jQ()
{
CKEDITOR.instances.editor1.updateElement();
}
The contentDom event worked for me and not the instanceReady... I would really like to know what the events ae, but I assume they are proprietary...
var editor = CKEDITOR.replace('editor');
CKEDITOR.instances.editor.on("instanceReady", function(){
this.on('contentDom', function() {
this.document.on('keydown', function(event) {
CKEDITOR.tools.setTimeout( function(){
$(".seldiv").html(CKEDITOR.instances.editor.getData());
}, 1);
});
});
this.on('contentDom', function() {
this.document.on('paste', function(event) {
CKEDITOR.tools.setTimeout( function(){
$(".seldiv").html(CKEDITOR.instances.editor.getData());
}, 1);
});
});
edits_clix();
var td = setTimeout("ebuttons()", 1);
})
Wouldn't it be better to do just this:
CKEDITOR.instances.editor1.on('contentDom', function() {
CKEDITOR.instances.editor1.document.on('keyup', function(event) {/*your instructions*/});
});
ref: http://cksource.com/forums/viewtopic.php?f=11&t=18286
Another generic solutions to this would be to run the following whenever you try to submit the form
for ( instance in CKEDITOR.instances )
CKEDITOR.instances[instance].updateElement();
This will force all CKEDITOR instances in the form to update their respective fields
I had success with this:
console.log(CKEDITOR.instances.editor1.getData());