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
});

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值