最近发现ZblogPHP在升级完UEditor编辑器后不能使用摘要分隔符,于是去查看代码。发现最新代码已经把原本分隔符是"<hr class="more" />" 变成了'<hr/>',于是去找方法。
1、去找最旧版本的UE编辑器,来回找那个代码。发现在文件ueditor.all.min.js里找到如下代码:
UE.plugins.horizontal= function(){this.commands.horizontal={execCommand:function(d){if(-1!==this.queryCommandState(d)){this.execCommand("insertHtml","<hr>");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、替换如上的代码为如下的代码:(在最旧版本:我能找到的最旧的版本。。(版本号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", '<hr class="more">') : this.execCommand("insertHtml", "<hr>"); d = this.selection.getRange(); var c = d.startContainer; if (1 == 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 = 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.保存完成后,刷新浏览器后,就可以使用了。
via 涂涂研版