2017-07-05 42 views
1

我在我的Angular应用程序中使用ckeditor4。当我离开页面时,控制台会发出如下警告:如何在Angular应用程序中销毁ckeditor?

[CKEDITOR] Error code: editor-destroy-iframe.
ckeditor.js:21 [CKEDITOR] For more information about this error go to http‌://docs.ckeditor.com/#!/guide/dev_errors-section-editor-destroy-iframe

我应该如何安全地卸载ckeditor组件?

+0

我找到了解决办法。你可以这样做,[错误代码:editor-destroy-iframe](https://github.com/chymz/ng2-ckeditor/issues/24) –

+0

我没有看到你发布的链接上的任何解决方案。关于开放式错误报告的一些模糊评论和建议。你能更具体地说明解决方案是什么吗? – AlanObject

回答

2

这是我如何解决了这个问题:

  1. 在你的HTML添加插件 'divarea' 是这样的:

    <ckeditor [config]={extraPlugins: 'divarea'}></ckeditor>

在这一点上控制台将仍然有一个404 e RROR:

Failed to load resource: the server responded with a status of 404 (Not Found)

  • 最后,你需要从 “全”,在您的index.html更改包地址为 “全全”。

    <script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>

  • reference

    +0

    尽管这个链接可能回答这个问题,但最好在这里包含答案的重要部分,并提供供参考的链接。如果链接页面更改,则仅链接答案可能会失效。 - [来自评论](/ review/low-quality-posts/16620145) – DavidG

    1

    在错误引用的页面的细节说:

    The editor's could not be destroyed correctly because it had been unloaded before the editor was destroyed. Make sure to destroy the editor before detaching it from the DOM.

    你应该做你清理你的角度成分的事件的onDestroy,这样它就会被破坏角去除周围的HTML元素之前。以下是文档上的onDestroy:

    https://angular.io/guide/lifecycle-hooks#ondestroy

    +0

    谢谢你的帮助 –

    +0

    这是正确的解决方案。使用'divarea'插件从根本上改变了CKeditor的行为 - 现在它不会加载它的标准contentCss文件,而是来自你网站的所有样式都会溢出到div中。也许你想要,但我发现大多数人不会。 – rmcsharry

    相关问题