Commit 15202ad1 authored by campaign's avatar campaign

修复编辑节点

parent 91215a80
......@@ -5,16 +5,16 @@
1. 添加保存时可修改文件名
2. 添加超链接功能
3. 选中节点时,按F2直接进入文字编辑状态
4. 展开所有收起节点
###问题修复
4. 添加展开收起节点
5. 当前选中的高亮的节点可直接进行文字编辑
##问题修复
1. 修复当滚动鼠标滚轮时,光标不跟着移动的问题
2. 优化了拖拽节点操作体验
3. 修复回退操作后所选节点未回选问题
4. 修复回退操作后展开收起的节点没有记录问题
5. ** 选中节点后可直接输入文字**
6. 优化了输入文字时的卡顿效果
7. 优化了当输入中文时,中文显示位置与光标距离过远的问题
5. 优化了输入文字时的卡顿效果
6. 优化了当输入中文时,中文显示位置与光标距离过远的问题
## v1.1.2
......
......@@ -28,13 +28,13 @@ KM.registerUI( 'contextmenu', function () {
});
me.$container.append($menu);
me.on('contextmenu',function(e){
if(this.getSelectedNodes().length == 0){
var node = e.getTargetNode();
if(node){
this.select(node);
}
var node = e.getTargetNode();
if(node){
this.removeAllSelectedNodes();
this.select(node)
}
var items = me.getContextmenu();
var data = [];
......
......@@ -252,7 +252,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
},
clone: function () {
function cloneNode( parent, isClonedNode,fn ) {
function cloneNode( parent, isClonedNode) {
var _tmp = new KM.MinderNode( isClonedNode.getText() );
_tmp.data = Utils.clonePlainObject( isClonedNode.getData() );
......@@ -264,13 +264,12 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
}
for ( var i = 0, ci;
( ci = isClonedNode.children[ i++ ] ); ) {
cloneNode( _tmp, ci ,fn);
cloneNode( _tmp, ci );
}
fn && fn(isClonedNode,_tmp);
return _tmp;
}
return function (fn) {
return cloneNode( null, this,fn );
return function () {
return cloneNode( null, this );
};
}(),
equals: function ( node ) {
......
......@@ -18,6 +18,30 @@ KityMinder.registerModule( "TextEditModule", function () {
return km.receiver.isTextEditStatus();
};
km.textEditNode = function(node){
var textShape = node.getTextShape();
this.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())
.updateTextData()
.updateSelectionShow()
.updateRange(range).setTextEditStatus(true);
sel.setData('relatedNode',node);
};
var selectionByClick = false;
var dragmoveTimer;
......@@ -72,7 +96,7 @@ KityMinder.registerModule( "TextEditModule", function () {
sel.setShow();
selectionByClick = false;
}
km.setStatus('textedit')
km.setStatus('textedit');
lastMousedownTimer = +new Date;
}
}
......
......@@ -198,9 +198,11 @@ Minder.Receiver = kity.createClass( 'Receiver', {
updateIndex: function () {
this.index = this.range.getStart().startOffset;
return this;
},
updateTextData: function () {
this.textShape.textData = this.getTextOffsetData();
return this;
},
setSelection: function ( selection ) {
this.selection = selection;
......
......@@ -4,24 +4,13 @@ KityMinder.registerModule( "HistoryModule", function () {
var Scene = kity.createClass( 'Scene', {
constructor: function ( root ) {
this.data = root.clone( function ( node, cloneNode ) {
km.fire( 'cloneNode', {
'targetNode': cloneNode,
'sourceNode': node
} )
} );
this.data = root.clone();
},
getData: function () {
return this.data;
},
cloneData: function () {
var fn = function ( node, cloneNode ) {
km.fire( 'cloneNode', {
'targetNode': cloneNode,
'sourceNode': node
} )
};
return this.getData().clone( fn );
return this.getData().clone( );
},
equals: function ( scene ) {
return this.getData().equals( scene.getData() )
......
......@@ -210,6 +210,7 @@ KityMinder.registerModule( "LayoutModule", function () {
return null;
}
km.select( selectedNode, true );
km.textEditNode(selectedNode);
},
queryState: function ( km ) {
var selectedNode = km.getSelectedNode();
......@@ -253,11 +254,6 @@ KityMinder.registerModule( "LayoutModule", function () {
},
"import": function ( e ) {
this.initStyle();
},
"cloneNode": function ( e ) {
var target = e.targetNode;
var source = e.sourceNode;
target._layout = utils.extend( {}, source._layout );
}
},
'contextmenu': [ {
......
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