我正在使用CKEditor作爲內容管理系統。當某人編輯頁面上的文本時,將使用CKEditor打開一個燈箱。當我關閉燈箱時,我的代碼破壞了CKEditor實例。當你再次打開它,我得到一個JavaScript錯誤,上面寫着「h是空」上ckeditor.jsCKEditor'h爲空'錯誤重新啓用燈箱時
這裏的第13行是我的代碼:
$('#editSidebarModuleLightbox').html(data);
if ($('#moduleText').length) {
CKEDITOR.replace('moduleText');
}
$('#editSidebarModuleLightbox').lightbox_me({
closeEsc: false,
closeClick: false,
destroyOnClose: true,
closeSelector: "button#cancelModuleEdit",
onLoad: function() {
$('button#saveModuleEdit').click(function() {
// Do stuff to save it
$('button#cancelModuleEdit').trigger('click');
});
},
onClose: function() {
if (CKEDITOR.instances['moduleText']) {
CKEDITOR.remove(CKEDITOR.instances['moduleText']);
}
}
});
我怎樣才能消除這個錯誤?