Easyui dialog重复打开加载UEditor失效

问题:Easyui dialog 打开加载UEditor第一次会成功,第二次打开就无效了

阅读 5.1k
1 个回答

dialog在关闭时需要销毁ueditor创建的对象,再次打开时重新渲染编辑器,参考代码:

页面:

<textare class="ueditor" id="content" ex-id="content"></textarea>

JavaScript代码:

$('#dd').dialog({
  onLoad:function(){
    if($('textarea.ueditor').length > 0){
        $('textarea.ueditor').each(function(){
          var id = $(this).attr('id');
          UE.getEditor(id, UeditorOptions);
        });
    }
  },
  onClose:function(){
   //销毁所有的ueditor
    if($('textarea.ueditor').length > 0 && typeof (UE) !== "undefined"){
      $('textarea.ueditor').each(function(){
        UE.getEditor($(this).attr('ex-id')).destroy();
      });
        }
 }
});
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题