views:

222

answers:

2

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?

A: 

when update the ckeditor to the newer version, always clear the browser cache! it's works for me...

smart
A: 

in my case i got the error cause of loading the ckeditor inside a

<div style="display:none;" > <more html > ckeditor </more html> </div>

if i delete the style="display:none;" everything works correctly ... but i couldnt copy the problem to a simple example ... the error just appears inside my cms when loading the ckeditor inside a invisible div container ...

maybe this can help some one ...

efesus