这个问题在这里已有答案:
我在Angular应用程序中使用ckeditor4 . 当我离开页面时,控制台会发出如下警告:
[CKEDITOR]错误代码:editor-destroy-iframe . ckeditor.js:21 [CKEDITOR]有关此错误的更多信息,请访问http://docs.ckeditor.com/#!/guide/dev_errors-section-editor-destroy-iframe
我该如何安全地卸载ckeditor组件?
这就是我解决问题的方法:
<ckeditor [config]={extraPlugins: 'divarea'}></ckeditor>
此时控制台仍会出现404错误:
无法加载资源:服务器响应状态为404(未找到)
<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>
reference
错误中引用的页面中的详细信息说:
编辑器无法正确销毁,因为它在编辑器被销毁之前已被卸载 . 确保在从DOM中分离编辑器之前销毁编辑器 .
您应该在Angular Component的onDestroy事件中进行清理,这样在Angular删除周围的HTML元素之前它将被销毁 . 以下是onDestroy上的文档:
https://angular.io/guide/lifecycle-hooks#ondestroy
2 回答
这就是我解决问题的方法:
<ckeditor [config]={extraPlugins: 'divarea'}></ckeditor>
此时控制台仍会出现404错误:
<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>
reference
错误中引用的页面中的详细信息说:
您应该在Angular Component的onDestroy事件中进行清理,这样在Angular删除周围的HTML元素之前它将被销毁 . 以下是onDestroy上的文档:
https://angular.io/guide/lifecycle-hooks#ondestroy