2017-01-09 45 views
1

我在我的Angular2項目中使用ng2-ckeditor。它工作正常,但是當我繼續使用另一個組件時,它會顯示警告消息[CKEDITOR] Error code: editor-destroy-iframe

我谷歌的解決方案和解決方案如下發現:CKEDITOR錯誤代碼:Angular 2中的editor-destroy-iframe

for (name in CKEDITOR.instances) { 
     CKEDITOR.instances[name].destroy(true); 
    } 

但是從哪裏得到CKEDITOR。在ng2-ckeditor包中,我只能看到2個庫CKEditorModule, CKEditorComponent

請幫我解決這個問題。

+3

我有主編破壞的iframe,凡在你的代碼,你把那個片段破壞編輯器類似的問題?我試圖放入ngOnDestroy,但它不工作。 – Konst

回答

2

嘗試添加打字稿定義文件中的CKEditor下的package.json devDependencies( 「@類型/ CKEditor的」: 「^ 0.0.34」):

"devDependencies": { 
    "@angular/compiler-cli": "~2.4.0", 
    "@angular/platform-server": "~2.4.0", 
    "@types/ckeditor": "^0.0.34" 
} 

然後運行NPM更新下載類型。 另一種解決方案是在你的文件中聲明的CKEditor:

declare const CKEDITOR: any; 
+0

這與報告的問題有什麼關係? – AlanObject