Commit 201b0f5e authored by campaign's avatar campaign

改进选中节点时,如果输入文字,节点内容会被先选中的问题

parent e8b42350
......@@ -95,7 +95,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me.inputTextTimer = setTimeout(function(){
me.km.layout(300);
},250);
},300);
}
me.re.updateTextOffsetData()
......@@ -104,8 +104,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me.selection
.updateOffsetByTextData(me.re.textData)
.updatePosition()
.setHoldShow();
.updatePosition();
//当然inputready状态时,如果输入文字,节点内文本会被先选中然后再消失,体验不好
if(me.km.getStatus() != 'inputready'){
me.selection.setHoldShow();
}
me.timer = setTimeout(function() {
......@@ -232,6 +237,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
//针对不能连续删除做处理
//if(keymap.Del == keyCode || keymap.Backspace == keyCode)
// me._setTextToContainer(keyCode);
me._setTextToContainer(keyCode);
},
_beforeKeyup:function(e){
......
......@@ -7,7 +7,12 @@ Minder.Range = kity.createClass('Range',function(){
if(node.nodeType == 1){
//默认不会出现得不到子节点的情况
node = node.childNodes[offset];
if(node.nodeType == 3){
if(!node && rng.startContainer && rng.startContainer.nodeName == 'DIV' ) {
rng.startContainer.innerHTML = '<p></p>';
offset = 0;
}else if(node.nodeType == 3){
offset = 0;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment