提交 695314a7 编写于 作者: C campaign

by zhanyi

上级 466bc6c6
...@@ -326,6 +326,9 @@ ...@@ -326,6 +326,9 @@
return browser.ie ? nativeRange.text : nativeRange.toString(); return browser.ie ? nativeRange.text : nativeRange.toString();
} }
return ''; return '';
},
clearRange : function(){
this.getNative()[browser.ie ? 'empty' : 'removeAllRanges']();
} }
}; };
})(); })();
\ No newline at end of file
...@@ -864,10 +864,24 @@ UE.plugins['table'] = function () { ...@@ -864,10 +864,24 @@ UE.plugins['table'] = function () {
function mouseUpEvent(type, evt) { function mouseUpEvent(type, evt) {
if (evt.button == 2)return; if (evt.button == 2)return;
var me = this;
//清除表格上原生跨选问题
var range = me.selection.getRange(),
start = domUtils.findParentByTagName(range.startContainer,'table',true),
end = domUtils.findParentByTagName(range.endContainer,'table',true);
if(start || end ){
if(start === end){
start = domUtils.findParentByTagName(range.startContainer,['td','th','caption'],true);
end = domUtils.findParentByTagName(range.endContainer,['td','th','caption'],true);
if(start !== end){
me.selection.clearRange()
}
}else{
me.selection.clearRange()
}
}
mousedown = false; mousedown = false;
// if(browser.ie && !me.body.contentEditable){
// me.body.contentEditable = true;
// }
me.document.body.style.webkitUserSelect = ''; me.document.body.style.webkitUserSelect = '';
//拖拽状态下的mouseUP //拖拽状态下的mouseUP
if ((!browser.ie || (browser.ie && browser.version > 7)) && onDrag && dragTd) { if ((!browser.ie || (browser.ie && browser.version > 7)) && onDrag && dragTd) {
...@@ -890,7 +904,6 @@ UE.plugins['table'] = function () { ...@@ -890,7 +904,6 @@ UE.plugins['table'] = function () {
return; return;
} }
//正常状态下的mouseup //正常状态下的mouseup
var range = null;
if (!startTd) { if (!startTd) {
var target = domUtils.findParentByTagName(evt.target || evt.srcElement, "td", true); var target = domUtils.findParentByTagName(evt.target || evt.srcElement, "td", true);
if (!target) target = domUtils.findParentByTagName(evt.target || evt.srcElement, "th", true); if (!target) target = domUtils.findParentByTagName(evt.target || evt.srcElement, "th", true);
...@@ -927,6 +940,7 @@ UE.plugins['table'] = function () { ...@@ -927,6 +940,7 @@ UE.plugins['table'] = function () {
} }
function mouseOverEvent(type, evt) { function mouseOverEvent(type, evt) {
var me = this;
currentTd = evt.target || evt.srcElement; currentTd = evt.target || evt.srcElement;
//需要判断两个TD是否位于同一个表格内 //需要判断两个TD是否位于同一个表格内
if (startTd && if (startTd &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册