Recently, the customer reported that after upgrading the UEditor editor, the summary separator , cannot be used, so he went to check the code. I found that the latest code has changed the original separator from “
” to '
', so I went to find a way.
1. Find the oldest Version UE Editor , to find that code back and forth. Found the following code in the file ueditor.all.min.js :UE.plugins.horizontal=
function(){this.commands.horizontal={execCommand:function( d){if(-1!==this.queryCommandState(d)){this.execCommand(“insertHtml”,”
“);d=this. selection.getRange();var b=d.startContainer;if(1==b.nodeType&&!b.childNodes[d.startOffset]){var c;(c=b.childNodes [d.startOffset-1])&&1==c.nodeType&&”HR”==c.tagName&&(“p”==this.options.enterTag ?(c=this.document.createElement(“p”),d.insertNode(c),d.setStart(c,0).setCursor()):(c=this.document.createElement(” br”),d.insertNode(c),d.setStartBefore(c).setCursor()))}return!0}},
queryCommandState:function(){return f.filterNodeList(this.selection.getStartElementPath( ),”table”)?-1:0}};this.addListener(“delkeydown”,function(d,b){var c=this.selection.getRange();c.txtToElmBoundary(!0); if(f.isStartInblock(c)){var a=c.startContainer.previousSibling;if(a&&f.isTagNode(a,”hr”)) return f.remove(a),c.select(),f. preventDefault(b),!0}})};
2. Replace the above code with the following code : (in the oldest version : the oldest version I can find . . (Version number 1.4.4.)) UE.plugins.horizontal = function() {
this.commands.horizontal = {
execCommand: function( d) {
if ( – 1 !== this.queryCommandState(d)) {
0 == this.document .getElementsByTagName(“hr”).length ? this.execCommand(“insertHtml”, '
') : this.execCommand(“insertHtml”, “
” );
d = this.selection.getRange();
var c = d.startContainer;
if (1 =& #61; c.nodeType && !c.childNodes[d.startOffset]) {
var b; (b = c.childNodes[d.startOffset – 1]) && 1 = ;= b.nodeType && “HR” == b.tagName && (“p” == this.options.enterTag ? (b = this. document.createElement(“p”), d.insertNode(b), d.setStart(b, 0).setCursor()) : (b = this.document.createElement(“br”), d.insertNode (b), d.setStartBefore(b).setCursor()))
}
return ! 0
}
} ,
queryCommandState: function() {
return f.filterNodeList(this.selection.getStartElementPath(), “table”) ? -1 : 0
}
};
this.addListener(“delkeydown”,
function(d, c) {
var b &# 61; this.selection.getRange();
b.txtToElmBoundary(!0);
if (f.isStartInblock(b)) {
var a = b.startContainer.previousSibling;
if (a && f.isTagNode(a, “hr”)) return f.remove(a),
b. select(),
f.preventDefault(c),
!0
}
})
};
3. After saving,refresh the browser,it can be used.