未捕获的异常:[CKEDITOR.editor] 实例已存在
我已在我的网站上添加了 CKEditor。即使我收到此 JS 错误,一切仍然有效:
未捕获的异常:[CKEDITOR.editor] 实例“simple_editor”已存在。
下面的代码包含在一个 PHP 文件中,我将其包含在我想要的位置编辑。我每页只有一个编辑器实例。
<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>
经过一番谷歌搜索后,我看到人们发布了一些不起作用的解决方案。
if (CKEDITOR.instances['simple_editor']) { delete CKEDITOR.instances['simple_editor'] };
if (CKEDITOR.instances['simple_editor']) { CKEDITOR.instances['simple_editor'].destroy(); }
有人知道该怎么办吗? :S
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除 class='ckeditor' 因为它会触发自动替换系统。
remove class='ckeditor' as it's triggering the automatic replacement system.