2012-01-19 18 views
3

我知道在stackoverflow或谷歌上也有類似的問題,但目前爲止沒有任何幫助.. 我用最新穩定版本中的jquery適配器使用ckeditor。ckeditor initizialize and destroy

單擊後退和前進後,我的螢火有以下錯誤:

uncaught exception: [CKEDITOR.editor] The instance "cause" already exists 

當我現在試圖摧毀編輯:

var editor=jQuery("#cause").ckeditorGet(); 
editor.destroy(); 

我有以下錯誤:

CKEditor not yet initialized, use ckeditor() with callback. 

如果我嘗試逐步重現問題(除了後退/前進按鈕) 我得到的螢火一些不同的行爲

創建一個新的CKEditor

jQuery('#cause').ckeditor(); 

破壞編輯再次

var editor=jQuery('#cause').ckeditorGet(); 
editor.destroy(); 

嘗試重新編輯失敗(沒有任何警告或錯誤)

jQuery('#cause').ckeditor(); 

結果: textarea保留

預期的結果: 編輯再次出現

任何幫助,將不勝感激

+0

嗯一些奇怪的原因,我不能再重現我的問題...... yust想要讓你知道,刪除CKEDITOR.instances.cause;固定我的問題 – nfo

+1

相關崗位任何其他誰來到這裏http://stackoverflow.com/questions/1794219/ckeditor-instance-already-exists – Kevin

+0

你可以在這裏查看一個現場示例https://stackoverflow.com/questions/48902441/how-to-destroy- and-reinitialize-ckeditor-again/48902974#48902974 –

回答

4

我發現,它崩潰,如果它尚未手之前初始化。然而這工作。

銷燬實例。 (假設你有一個全球性的叫CKEDITOR

if(CKEDITOR){ 
    if(CKEDITOR.instances.editor1){ 
     CKEDITOR.instances.editor1.destroy(); 
    } 
} 
+0

如何使用jquery適配器調用此方法? –