2011-01-26 159 views
3

我試圖在JQuery UI對話框內實現CKEditor,當對話框第一次打開時它完美。CKEditor與JQuery UI對話框 - 不會顯示第二次

當我第二次打開對話框時,「style:hidden」和編輯器的文本區域沒有加載?

對話框

MyApp.Dialog = $('<div></div>'); 
     MyApp.Dialog 
     .dialog({ 
      modal: true, 
      autoOpen: false, 
      title: title, 
      width: width, 
      height: height, 
      close:function(){ 
       $(this).find('textarea').ckeditorGet().destroy(); 
      }, 
      buttons: { 
       'OK': function() { 
        form = $(this).find('form'); 
        if (form.validate().form() == true) { 
         MyApp.submitFormWithAjax(form, $(this)); 
        } else { 
         return false; 
        } 
       }, 
       Cancel: function() { 
        $(this).dialog('close'); 
       } 
      } 
     }); 

     MyApp.Dialog.load(url, function() { 
      EventManager.publish('showFormDialogLoaded'); 
     }); 

     MyApp.Dialog.dialog('open'); 

我的管理頁面上我等待的對話框加載..

$('.admin-create-article').click(function(event) { 
     MyApp.showFormDialog($(this).attr('href'), 'Neuer Artikel', 700, 630); 
     EventManager.subscribe('showFormDialogLoaded', function() { 
      $('.editor').ckeditor(function() {}, { skin : 'v2' }); 
     }); 
     event.preventDefault(); 
}); 

回答

4

我有同樣的問題,但現在它適用於我。

你必須做的每個對話結構(創建和銷燬CKEditor的):當我打開對話框第一次

if (CKEDITOR.instances.editorD != null && CKEDITOR.instances.editorD != 'undefined') 
    { 
     CKEDITOR.instances.editorD.destroy(); 
    } 

     CKEDITOR.replace('editorD', 
     { 
     language : 'fr', 
     toolbar_Mytoolbardata : 
     [ 
     ['Bold','Italic','Underline','Strike'], 
     ['FontName','FontSize'], 
     ['TextColor']// No comma for the last row. 
     ], 
     toolbar : 'Mytoolbardata', 
     skin: 'v2', 
     width : 403,  
     height : 25, 
     disableObjectResizing : true, 
     resize_enabled : false, 
     shiftEnterMode : CKEDITOR.ENTER_BR, 
     toolbarCanCollapse : false, 
     forcePasteAsPlainText : true 
     }); 
+0

隨着ckeditor v4.3,我沒有得到第二次啓動編輯器問題的問題,但我得到的工具欄的下拉元素第二次不工作。該解決方案解決了它。謝謝。 – frank 2014-07-10 20:06:00

0

腳本文件沒有加載或與其他一些腳本像jQuery UI腳本衝突。

+0

一切正常,如果我點擊鏈接再次對話框打開,但編輯器丟失。 – opHASnoNAME 2011-01-26 18:38:48