Commit aa08b06f authored by campaign's avatar campaign

添加选中节点后可直接输入文字

parent 701ea9bc
...@@ -76,6 +76,7 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -76,6 +76,7 @@ KityMinder.registerModule( "TextEditModule", function () {
} }
}, },
'normal.mouseup textedit.mouseup':function(e){ 'normal.mouseup textedit.mouseup':function(e){
if(mouseDownStatus){ if(mouseDownStatus){
if(!sel.collapsed ){ if(!sel.collapsed ){
try{ try{
...@@ -86,8 +87,37 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -86,8 +87,37 @@ KityMinder.registerModule( "TextEditModule", function () {
}else }else
sel.setShow() sel.setShow()
}else{
//当选中节点后,输入状态准备
var node = e.getTargetNode();
if(node){
if ( this.isSingleSelect() && node.isSelected()) {
var textShape = node.getTextShape();
km.setStatus('textedit');
sel.setHide();
sel.setStartOffset(0);
sel.setEndOffset(textShape.getContent().length);
receiver.setTextEditStatus(true)
.setSelection(sel)
.setKityMinder(this)
.setMinderNode(node)
.setTextShape(textShape)
.setRange(range)
.setBaseOffset()
.setContainerStyle()
.setSelectionHeight()
.setContainerTxt(textShape.getContent())
.updateRange(range).setTextEditStatus(true);
sel.setData('relatedNode',node);
}
}
} }
mouseDownStatus = false; mouseDownStatus = false;
oneTime = 0; oneTime = 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