Commit e60fae33 authored by Akikonata's avatar Akikonata

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

parents 91c9bff2 06532951
......@@ -252,23 +252,25 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
},
clone: function () {
function cloneNode( parent, isClonedNode ) {
function cloneNode( parent, isClonedNode,fn ) {
var _tmp = new KM.MinderNode( isClonedNode.getText() );
_tmp.data = Utils.clonePlainObject( isClonedNode.getData() );
_tmp.tmpData = Utils.clonePlainObject( isClonedNode.getTmpData() )
_tmp.tmpData = Utils.clonePlainObject( isClonedNode.getTmpData() );
_tmp.parent = parent;
if ( parent ) {
parent.children.push( _tmp );
}
for ( var i = 0, ci;
( ci = isClonedNode.children[ i++ ] ); ) {
cloneNode( _tmp, ci );
cloneNode( _tmp, ci ,fn);
}
fn && fn(isClonedNode,_tmp);
return _tmp;
}
return function () {
return cloneNode( null, this );
return function (fn) {
return cloneNode( null, this,fn );
};
}(),
equals: function ( node ) {
......@@ -311,6 +313,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
isHighlight: function () {
return this.getTmpData( 'highlight' )
},
select:function(){
this.setTmpData('highlight',true)
},
setTmpData: function ( a, v ) {
var me = this;
if ( utils.isObject( a ) ) {
......
......@@ -247,7 +247,7 @@ var utils = Utils = KityMinder.Utils = {
}
};
element.onerror = function () {
throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file umeditor.config.js ')
throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file ')
};
doc.getElementsByTagName("head")[0].appendChild(element);
}
......
......@@ -4,13 +4,23 @@ KityMinder.registerModule( "HistoryModule", function () {
var Scene = kity.createClass( 'Scene', {
constructor: function ( root ) {
this.data = root.clone();
this.data = root.clone(function(node,cloneNode){
km.fire('cloneNode',{
'targetNode':cloneNode,
'sourceNode':node
})
});
},
getData: function () {
return this.data;
},
cloneData: function () {
return this.getData().clone();
var fn = function(node,cloneNode){
km.fire('cloneNode',{
'targetNode':cloneNode,
'sourceNode':node
})};
return this.getData().clone(fn);
},
equals: function ( scene ) {
return this.getData().equals( scene.getData() )
......@@ -155,11 +165,10 @@ KityMinder.registerModule( "HistoryModule", function () {
"saveScene": function ( e ) {
this.historyManager.saveScene();
},
"renderNode": function ( e ) {
'renderNode':function(e){
var node = e.node;
if ( node.isHighlight() ) {
km.select( node );
if(node.isSelected()){
this.select(node)
}
},
"keydown": function ( e ) {
......
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