提交 92bf0a33 编写于 作者: C campaign

by zhanyi

上级 a2bb0c78
...@@ -1115,14 +1115,27 @@ var domUtils = dom.domUtils = { ...@@ -1115,14 +1115,27 @@ var domUtils = dom.domUtils = {
isBr:function (node) { isBr:function (node) {
return node.nodeType == 1 && node.tagName == 'BR'; return node.nodeType == 1 && node.tagName == 'BR';
}, },
isFillChar:function (node) { isFillChar:function (node,isInStart) {
return node.nodeType == 3 && !node.nodeValue.replace(new RegExp(domUtils.fillChar), '').length return node.nodeType == 3 && !node.nodeValue.replace(new RegExp((isInStart ? '^' : '' ) + domUtils.fillChar), '').length
}, },
isStartInblock:function (range) { isStartInblock:function (range) {
var tmpRange = range.cloneRange(), var tmpRange = range.cloneRange(),
flag = 0, flag = 0,
start = tmpRange.startContainer, start = tmpRange.startContainer,
tmp; tmp;
if(start.nodeType == 1 && start.childNodes[tmpRange.startOffset]){
start = start.childNodes[tmpRange.startOffset];
var pre = start.previousSibling;
while(pre && domUtils.isFillChar(pre)){
start = pre;
pre = pre.previousSibling;
}
}
if(this.isFillChar(start,true) && tmpRange.startOffset == 1){
tmpRange.setStartBefore(start);
start = tmpRange.startContainer;
}
while (start && domUtils.isFillChar(start)) { while (start && domUtils.isFillChar(start)) {
tmp = start; tmp = start;
start = start.previousSibling start = start.previousSibling
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册