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

来源:互联网 发布:xp如何添加网络打印机 编辑:程序博客网 时间:2024/04/29 00:02

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
});
0 0
原创粉丝点击