最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ckeditor initizialize and destroy - Stack Overflow

programmeradmin5浏览0评论

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 e up again

any help would be appreciated

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 e up again

any help would be appreciated

Share Improve this question asked Jan 19, 2012 at 11:16 nfonfo 6472 gold badges6 silver badges19 bronze badges 3
  • 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 Commented Jan 19, 2012 at 12:56
  • 1 related post to any others who e here stackoverflow./questions/1794219/… – Kevin Commented Jul 2, 2012 at 20:13
  • You can check a live example here stackoverflow./questions/48902441/… – SAMUEL Commented Feb 21, 2018 at 10:05
Add a ment  | 

1 Answer 1

Reset to default 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();
    }
}
发布评论

评论列表(0)

  1. 暂无评论