4

I know there are similar question on stackoverflow or google, but nothing helps so far.. I use ckeditor with jquery adapter in leatest stable version.

After clicking back and forward i got following error in firebug:

uncaught exception: [CKEDITOR.editor] The instance "cause" already exists

when i now try to destroy the editor by:

var editor=jQuery("#cause").ckeditorGet();
editor.destroy();

i got following error:

CKEditor not yet initialized, use ckeditor() with callback.

If i try to reproduce the issue step by step (except the back/forward button) i got some different behavior in firebug

create a new ckeditor

jQuery('#cause').ckeditor();

destroy the editor again

var editor=jQuery('#cause').ckeditorGet();
editor.destroy();

try to recreate the editor fails (without any warning or error)

jQuery('#cause').ckeditor();

result: the textarea stays

expected result: the editor come up again

any help would be appreciated

nfo
  • 637
  • 2
  • 6
  • 19
  • hmm for some strange reasons i cannot reproduce my problem anymore... yust want let you know that delete CKEDITOR.instances.cause; fixed my issue – nfo Jan 19 '12 at 12:56
  • 1
    related post to any others who come here http://stackoverflow.com/questions/1794219/ckeditor-instance-already-exists – Kevin Jul 02 '12 at 20:13
  • You can check a live example here https://stackoverflow.com/questions/48902441/how-to-destroy-and-reinitialize-ckeditor-again/48902974#48902974 – SAMUEL Feb 21 '18 at 10:05

1 Answers1

4

I found that it crashes if it has not already been initialised before hand. However this works.

Destroy the instance. (assuming that you have a global called CKEDITOR.

if(CKEDITOR){
    if(CKEDITOR.instances.editor1){
        CKEDITOR.instances.editor1.destroy();
    }
}
Stuart
  • 76
  • 4