Commit 91fe97f1 authored by Akikonata's avatar Akikonata

format

parent 09315d6f
...@@ -41,7 +41,7 @@ function importNode( node, json, km ) { ...@@ -41,7 +41,7 @@ function importNode( node, json, km ) {
for ( var field in data ) { for ( var field in data ) {
node.setData( field, data[ field ] ); node.setData( field, data[ field ] );
} }
node.setData( 'text',data.text || km.getLang( DEFAULT_TEXT[ node.getType() ] ) ); node.setData( 'text', data.text || km.getLang( DEFAULT_TEXT[ node.getType() ] ) );
var childrenTreeData = json.children; var childrenTreeData = json.children;
if ( !childrenTreeData ) return; if ( !childrenTreeData ) return;
...@@ -53,7 +53,6 @@ function importNode( node, json, km ) { ...@@ -53,7 +53,6 @@ function importNode( node, json, km ) {
return node; return node;
} }
// 导入导出 // 导入导出
kity.extendClass( Minder, { kity.extendClass( Minder, {
exportData: function ( protocalName ) { exportData: function ( protocalName ) {
...@@ -62,11 +61,11 @@ kity.extendClass( Minder, { ...@@ -62,11 +61,11 @@ kity.extendClass( Minder, {
json = exportNode( this.getRoot() ); json = exportNode( this.getRoot() );
protocal = KityMinder.findProtocal( protocalName ); protocal = KityMinder.findProtocal( protocalName );
if(this._fire( new MinderEvent( 'beforeexport', { if ( this._fire( new MinderEvent( 'beforeexport', {
json:json, json: json,
protocalName: protocalName, protocalName: protocalName,
protocal: protocal protocal: protocal
},true ) ) === true) return; }, true ) ) === true ) return;
if ( protocal ) { if ( protocal ) {
return protocal.encode( json, this ); return protocal.encode( json, this );
...@@ -106,22 +105,22 @@ kity.extendClass( Minder, { ...@@ -106,22 +105,22 @@ kity.extendClass( Minder, {
//******************* //*******************
function ts(d, str, last){ function ts( d, str, last ) {
var h = d.getHours(), var h = d.getHours(),
m = d.getMinutes(), m = d.getMinutes(),
s = d.getSeconds(), s = d.getSeconds(),
ms = d.getMilliseconds(); ms = d.getMilliseconds();
if(last){ if ( last ) {
console.log('--- '+str+': '+(d-last)+' ---'); console.log( '--- ' + str + ': ' + ( d - last ) + ' ---' );
}else{ } else {
console.log('--- '+str+' ---'); console.log( '--- ' + str + ' ---' );
} }
return d; return d;
} }
var t1 = ts(new Date(), '开始解析'); var t1 = ts( new Date(), '开始解析' );
//******************* //*******************
json = params.json || ( params.json = protocal.decode( local ) ); json = params.json || ( params.json = protocal.decode( local ) );
...@@ -130,20 +129,20 @@ kity.extendClass( Minder, { ...@@ -130,20 +129,20 @@ kity.extendClass( Minder, {
var self = this; var self = this;
json.then( local, function ( data ) { json.then( local, function ( data ) {
//******************* //*******************
var t2 = ts(new Date(), '解压解析耗时', t1); var t2 = ts( new Date(), '解压解析耗时', t1 );
//******************* //*******************
self._afterImportData( data, params ); self._afterImportData( data, params );
//******************* //*******************
ts(new Date(), '渲染耗时', t2); ts( new Date(), '渲染耗时', t2 );
//******************* //*******************
} ); } );
} else { } else {
//******************* //*******************
var t2 = ts(new Date(), '解压解析耗时', t1); var t2 = ts( new Date(), '解压解析耗时', t1 );
//******************* //*******************
this._afterImportData( json, params ); this._afterImportData( json, params );
//******************* //*******************
ts(new Date(), '渲染耗时', t2); ts( new Date(), '渲染耗时', t2 );
//******************* //*******************
} }
return this; return this;
......
...@@ -51,6 +51,11 @@ KityMinder.registerModule( "Expand", function () { ...@@ -51,6 +51,11 @@ KityMinder.registerModule( "Expand", function () {
} }
} ); } );
return { return {
'events': {
'importData': function ( e ) {
var data = e.data;
}
},
'commands': {} 'commands': {}
}; };
} ); } );
\ No newline at end of file
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