2011-01-26 67 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