2017-07-05 80 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

    相關問題