ckeditor initizialize and destroy

拜拜、爱过 提交于 2019-12-23 16:28:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!