我知道在 stackoverflow 或 google 上也有类似的问题,但到目前为止没有任何帮助.. 我在最新的稳定版本中使用带有 jquery 适配器的 ckeditor。
点击后退和前进后,我在 firebug 中收到以下错误:
uncaught exception: [CKEDITOR.editor] The instance "cause" already exists
当我现在尝试通过以下方式破坏编辑器时:
var editor=jQuery("#cause").ckeditorGet();
editor.destroy();
我得到以下错误:
CKEditor not yet initialized, use ckeditor() with callback.
如果我尝试逐步重现问题(后退/前进按钮除外) 我在 Firebug 中有一些不同的行为
创建一个新的ckeditor
jQuery('#cause').ckeditor();
再次销毁编辑器
var editor=jQuery('#cause').ckeditorGet();
editor.destroy();
尝试重新创建编辑器失败(没有任何警告或错误)
jQuery('#cause').ckeditor();
结果: 文本区域保持不变
预期结果: 小编又上来了
任何帮助将不胜感激
最佳答案
我发现如果事先没有初始化它会崩溃。然而,这有效。
销毁实例。 (假设您有一个名为 CKEDITOR 的全局变量。
if(CKEDITOR){
if(CKEDITOR.instances.editor1){
CKEDITOR.instances.editor1.destroy();
}
}
关于javascript - ckeditor初始化并销毁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8925094/