未捕获异常:[CKEDITOR.editor]实例已存在 [英] uncaught exception: [CKEDITOR.editor] The instance already exists

查看:327
本文介绍了未捕获异常:[CKEDITOR.editor]实例已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上加入了CKEditor。一切正常,即使我得到这个JS错误:



未捕获异常:[CKEDITOR.editor]实例simple_editor p>

下面的代码包含在PHP文件中,我包含了我想要的编辑器。我只有每页一个编辑器的实例。

 < textarea class ='ckeditor'id ='simple_editor'name = 'simple_editor'>。$ page_content。< / textarea>; 

< script type =text / javascript>
CKEDITOR.replace('simple_editor',
{
height:'110px',
工具栏:
[
['Link','Unlink'],
['Styles' Format','Font','FontSize'],
['Bold','Italic','Underline','Strike'],
['TextColor','BGColor'],
['NumberedList','BulletedList','Outdent','Indent']
]
});
< / script>



在一些Google搜索后,我看到人们发布了一些dosnt工作的解决方案。

  if(CKEDITOR.instances ['simple_editor']){delete CKEDITOR.instances ['simple_editor']}; 
if(CKEDITOR.instances ['simple_editor']){CKEDITOR.instances ['simple_editor']。destroy();}

任何人都知道该怎么办: p>

解决方案

remove class ='ckeditor',因为它触发自动替换系统。


I've included the CKEditor on my site. Everything works even though I get this JS error:

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

The code below is contained inside a PHP file which I include where ever I want the editor. I only have one instance of the editor per page.

<textarea class='ckeditor' id='simple_editor' name='simple_editor'>".$page_content."</textarea>";

<script type="text/javascript">
 CKEDITOR.replace( 'simple_editor',
 { 
  height: '110px',
  toolbar :
  [
   ['Link','Unlink'],
   ['Styles','Format','Font','FontSize'],
   ['Bold','Italic','Underline','Strike'],
   ['TextColor','BGColor'],
   ['NumberedList','BulletedList','Outdent','Indent']
  ]
 }); 
</script>

After some googling I've seen people posting some solution which dosnt work.

if (CKEDITOR.instances['simple_editor']) { delete CKEDITOR.instances['simple_editor'] };
if (CKEDITOR.instances['simple_editor']) { CKEDITOR.instances['simple_editor'].destroy(); }

Anyone know what to do? :S

解决方案

remove class='ckeditor' as it's triggering the automatic replacement system.

这篇关于未捕获异常:[CKEDITOR.editor]实例已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆