Commit cfa6c9a3 authored by techird's avatar techird

Merge branch 'dev' of github.com:fex-team/kityminder into dev

parents 64b250b0 b5904d59
...@@ -112,7 +112,6 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -112,7 +112,6 @@ KityMinder.registerModule('TextEditModule', function() {
.setRange(range) .setRange(range)
.setReady(); .setReady();
if(selectionReadyShow){ if(selectionReadyShow){
...@@ -124,12 +123,13 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -124,12 +123,13 @@ KityMinder.registerModule('TextEditModule', function() {
dblclickEvent = false; dblclickEvent = false;
return; return;
} }
sel.collapse(true) sel.collapse(true)
.updatePosition(receiver.getOffsetByIndex()) .updatePosition(receiver.getOffsetByIndex())
.setShow(); .setShow();
textGroup.setStyle('cursor','text'); textGroup.setStyle('cursor','text');
}, 200); },200);
km.setStatus('textedit'); km.setStatus('textedit');
} }
......
...@@ -53,7 +53,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -53,7 +53,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
this._keyup(e); this._keyup(e);
} }
}, },
_setTextToContainer : function(keyCode){ _setTextToContainer : function(keyCode,iskeyUp){
var me = this; var me = this;
//同步节点 //同步节点
me.minderNode = me.re.minderNode; me.minderNode = me.re.minderNode;
...@@ -65,7 +65,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -65,7 +65,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
} }
if(keymap.controlKeys[keyCode]){ if(keymap.controlKeys[keyCode] && !iskeyUp ){
return; return;
} }
//当第一次输入内容时进行保存 //当第一次输入内容时进行保存
...@@ -98,6 +98,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -98,6 +98,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
},300); },300);
} }
me.re.updateTextOffsetData() me.re.updateTextOffsetData()
.updateRange() .updateRange()
.updateSelectionByRange(); .updateSelectionByRange();
...@@ -193,7 +194,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -193,7 +194,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
//修正在cvs方式下_keyup会把节点文字选中 //修正在cvs方式下_keyup会把节点文字选中
this.isShortcutCopyKey = true; this.isShortcutCopyKey = true;
this.km.setStatus('normal'); this.km.setStatus('normal');
return; return;
} }
...@@ -241,7 +241,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -241,7 +241,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me._setTextToContainer(keyCode); me._setTextToContainer(keyCode);
}, },
_beforeKeyup:function(e){ _beforeKeyup:function(e){
var me = this; var me = this;
var orgEvt = e.originEvent; var orgEvt = e.originEvent;
var keyCode = orgEvt.keyCode; var keyCode = orgEvt.keyCode;
...@@ -265,7 +264,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -265,7 +264,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
} }
if (keymap.Enter == keyCode && (this.isTypeText || browser.mac && browser.gecko)) { if (keymap.Enter == keyCode && (this.isTypeText || browser.mac && browser.gecko)) {
me._setTextToContainer(keyCode); me._setTextToContainer(keyCode,true);
} }
if (this.re.keydownNode === this.re.minderNode) { if (this.re.keydownNode === this.re.minderNode) {
this.km.rollbackStatus(); this.km.rollbackStatus();
...@@ -283,19 +282,20 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){ ...@@ -283,19 +282,20 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
} }
} }
me._setTextToContainer(keyCode); me._setTextToContainer(keyCode,true);
return; return;
} }
if (this.isTypeText) { if (this.isTypeText) {
me._setTextToContainer(keyCode); me._setTextToContainer(keyCode,true);
return; return;
} }
if (browser.mac && browser.gecko){ if (browser.mac && browser.gecko){
me._setTextToContainer(keyCode); me._setTextToContainer(keyCode,true);
return; return;
} }
me._setTextToContainer(keyCode);
me._setTextToContainer(keyCode,true);
return true; return true;
}, },
......
...@@ -86,7 +86,7 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -86,7 +86,7 @@ Minder.Selection = kity.createClass( 'Selection', {
'z']; 'z'];
}; };
offset = offset || this.offset; offset = offset !== undefined ? offset : this.offset;
if(this.collapsed){ if(this.collapsed){
if (isNaN(offset.x) || isNaN(offset.y)) { if (isNaN(offset.x) || isNaN(offset.y)) {
......
...@@ -232,7 +232,7 @@ KityMinder.registerModule('View', function() { ...@@ -232,7 +232,7 @@ KityMinder.registerModule('View', function() {
var minder = this; var minder = this;
['up', 'down', 'left', 'right'].forEach(function(name) { ['up', 'down', 'left', 'right'].forEach(function(name) {
if (e.isShortcutKey('ctrl+' + name)) { if (e.isShortcutKey('ctrl+' + name) && minder.getStatus() != 'textedit') {
minder.removeAllSelectedNodes(); minder.removeAllSelectedNodes();
minder.execCommand('move', name, 100); minder.execCommand('move', name, 100);
e.preventDefault(); e.preventDefault();
......
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