Commit 49035271 authored by techird's avatar techird

Merge branch 'dev' of https://github.com/kitygraph/kityminder into dev

parents a4b3a6f8 741c25b9
......@@ -3,7 +3,7 @@ KityMinder.registerModule( "TextEditModule", function () {
var receiver = new Minder.Receiver(this);
var range = new Minder.Range();
this.receiver = receiver;
return {
//插入光标
"init":function(){
......@@ -34,6 +34,10 @@ KityMinder.registerModule( "TextEditModule", function () {
},
'restoreScene':function(){
cursor.setHide();
},
'stopTextEdit':function(){
cursor.setHide();
}
}
};
......
......@@ -79,7 +79,7 @@ Minder.Receiver = kity.createClass('Receiver',{
case keymap.Tab:
this.setTextEditStatus(false);
this.clear();
e.stopPropagation();
e.preventDefault();
return;
case keymap.Shift:
case keymap.Control:
......@@ -90,9 +90,11 @@ Minder.Receiver = kity.createClass('Receiver',{
}
var text = (this.container.textContent || this.container.innerText).replace(/\u200b/g,'');
this.textShape.setContent(text);
this.setContainerStyle();
this.minderNode.setText(text);
this.km.updateLayout(this.minderNode);
this.setBaseOffset();
this.updateTextData();
......
......@@ -62,6 +62,23 @@ KityMinder.registerModule( "KeyboardModule", function () {
},
keydown: function ( e ) {
var keys = KityMinder.keymap;
if(this.receiver.isTextEditStatus()){
switch ( e.originEvent.keyCode ) {
case keys.Enter:
case keys.Tab:
this.fire('stopTextEdit');
e.preventDefault();
break;
case keys.Backspace:
case keys.Del:
case keys.Left:
case keys.Up:
case keys.Right:
case keys.Down:
break;
}
return;
}
switch ( e.originEvent.keyCode ) {
case keys.Enter:
this.execCommand( 'appendSiblingNode', new MinderNode( 'Topic' ) );
......
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