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