问题
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
回答1:
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();
}
}
来源:https://stackoverflow.com/questions/8925094/ckeditor-initizialize-and-destroy