I'm using CKEditor for a Content Management System. When someone edits the text on a page, a lightbox opens with CKEditor. When I close the lightbox, my code destroys the CKEditor instance. When you open it again, I get a Javascript error that says 'h is null' on line 13 of ckeditor.js
Here's my code:
$('#editSidebarModuleLightbox').html(data);
if ( $('#moduleText').length ) {
CKEDITOR.replace('moduleText');
}
$('#editSidebarModuleLightbox').lightbox_me({
closeEsc: false,
closeClick: false,
destroyOnClose: true,
closeSelector: "button#cancelModuleEdit",
onLoad: function() {
$('button#saveModuleEdit').click(function() {
// Do stuff to save it
$('button#cancelModuleEdit').trigger('click');
});
},
onClose: function() {
if (CKEDITOR.instances['moduleText']) {
CKEDITOR.remove(CKEDITOR.instances['moduleText']);
}
}
});
How can I eliminate this error?