Ueditor富编辑器第二次打开的时候会渲染失败

1、在页面或窗口关闭的时候,通过监听页面或窗口事件,在函数里面销毁富编辑器

if(typeof(UE.getEditor("newsContentAdd")) !='undefined'){
         UE.getEditor("newsContentAdd").destroy();
}

2、在页面每次初始化的时候,先删除掉以前的编辑器,再次进行初始化

//先删除掉以前的ueditor,否则第二次打开的时候会渲染失败
UE.delEditor("newsContent");
//初始化渲染ueditor
var newsContent = UE.getEditor('newsContent',{
initialFrameWidth:1000,initialFrameHeight:450,
toolbars:[
          ['source','undo','redo','bold','italic','underline','fontborder','strikethrough','superscript','subscript', 'removeformat','formatmatch','autotypeset','blockquote','pasteplain','|','forecolor','backcolor','insertorderedlist','insertunorderedlist','selectall','cleardoc','rowspacingtop','rowspacingbottom','lineheight','|','background'],
          ['fontfamily','fontsize','|','justifyleft','justifycenter','justifyright','justifyjustify','|','imagenone','imageleft','imageright','imagecenter','|','insertimage','emotion','|','inserttable','deletetable','insertparagraphbeforetable','insertrow','deleterow','insertcol','deletecol','mergecells','mergeright','mergedown','splittocells','splittorows','splittocols','|','preview']
         ]
    ,emotionLocalization:true
    ,wordCount:false,autoFloatEnabled:false
});

你可能感兴趣的:(ueditor)