Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
e0eb38d7
Commit
e0eb38d7
authored
Sep 22, 2015
by
hy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对core中data下的方法做微调
parent
a53b755f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
23 deletions
+40
-23
data.js
src/core/data.js
+40
-23
No files found.
src/core/data.js
View file @
e0eb38d7
...
...
@@ -77,28 +77,6 @@ define(function(require, exports, module) {
return
JSON
.
parse
(
JSON
.
stringify
(
json
));
},
/**
* @method importNode()
* @description 根据纯json {data, children}数据转换成为脑图节点
* @Editor: Naixor
* @Date: 2015.9.20
*/
importNode
:
function
(
node
,
json
)
{
var
data
=
json
.
data
;
node
.
data
=
{};
for
(
var
field
in
data
)
{
node
.
setData
(
field
,
data
[
field
]);
}
var
childrenTreeData
=
json
.
children
||
[];
for
(
var
i
=
0
;
i
<
childrenTreeData
.
length
;
i
++
)
{
var
childNode
=
this
.
createNode
(
null
,
node
);
this
.
importNode
(
childNode
,
childrenTreeData
[
i
]);
}
return
node
;
},
/**
* function Text2Children(MinderNode, String)
* @param {MinderNode} node 要导入数据的节点
...
...
@@ -187,7 +165,46 @@ define(function(require, exports, module) {
importChildren
(
node
,
children
);
minder
.
refresh
();
},
/**
* @method exportNode(MinderNode)
* @param {MinderNode} node 当前要被导出的节点
* @return {Object} 返回只含有data和children的Object
* @Editor: Naixor
* @Date: 2015.9.22
*/
exportNode
:
function
(
node
)
{
var
exported
=
{};
exported
.
data
=
node
.
getData
();
var
childNodes
=
node
.
getChildren
();
exported
.
children
=
[];
for
(
var
i
=
0
;
i
<
childNodes
.
length
;
i
++
)
{
exported
.
children
.
push
(
this
.
exportNode
(
childNodes
[
i
]));
}
return
exported
;
},
/**
* @method importNode()
* @description 根据纯json {data, children}数据转换成为脑图节点
* @Editor: Naixor
* @Date: 2015.9.20
*/
importNode
:
function
(
node
,
json
)
{
var
data
=
json
.
data
;
node
.
data
=
{};
for
(
var
field
in
data
)
{
node
.
setData
(
field
,
data
[
field
]);
}
var
childrenTreeData
=
json
.
children
||
[];
for
(
var
i
=
0
;
i
<
childrenTreeData
.
length
;
i
++
)
{
var
childNode
=
this
.
createNode
(
null
,
node
);
this
.
importNode
(
childNode
,
childrenTreeData
[
i
]);
}
return
node
;
},
/**
* @method importJson()
* @for Minder
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment