1. 程式人生 > >Ueditor富編輯器第二次開啟的時候會渲染失敗

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