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
053e37b4
Commit
053e37b4
authored
Jul 06, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
old data compatibility
parent
4cb30e8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
12 deletions
+62
-12
import.js
import.js
+1
-0
kityminder.js
src/core/kityminder.js
+1
-1
minder.data.compatibility.js
src/core/minder.data.compatibility.js
+58
-0
minder.data.js
src/core/minder.data.js
+2
-11
No files found.
import.js
View file @
053e37b4
...
...
@@ -10,6 +10,7 @@
'core/module.js'
,
'core/event.js'
,
'core/minder.js'
,
'core/minder.data.compatibility.js'
,
'core/minder.data.js'
,
'core/minder.event.js'
,
'core/minder.module.js'
,
...
...
src/core/kityminder.js
View file @
053e37b4
...
...
@@ -3,7 +3,7 @@ var KityMinder = window.KM = window.KityMinder = function() {
instanceId
=
0
,
uuidMap
=
{};
return
{
version
:
'1.
1.3.1
'
,
version
:
'1.
2.0
'
,
uuid
:
function
(
name
)
{
name
=
name
||
'unknown'
;
uuidMap
[
name
]
=
uuidMap
[
name
]
||
0
;
...
...
src/core/minder.data.compatibility.js
0 → 100644
View file @
053e37b4
Utils
.
extend
(
KityMinder
,
{
compatibility
:
function
(
json
)
{
var
version
=
json
.
version
||
'1.1.3'
;
function
traverse
(
node
,
fn
)
{
fn
(
node
);
if
(
node
.
children
)
node
.
children
.
forEach
(
function
(
child
)
{
traverse
(
child
,
fn
);
});
}
/**
* 脑图数据升级
* v1.1.3 => v1.2.0
* */
function
c_113_120
(
json
)
{
// 原本的布局风格
var
ocs
=
json
.
data
.
currentstyle
;
delete
json
.
data
.
currentstyle
;
// 为 1.2 选择模板,同时保留老版本文件的皮肤
if
(
ocs
==
'bottom'
)
{
json
.
template
=
'structure'
;
json
.
theme
=
'snow'
;
}
else
if
(
ocs
==
'default'
)
{
json
.
template
=
'default'
;
json
.
theme
=
'classic'
;
}
traverse
(
json
,
function
(
node
)
{
var
data
=
node
.
data
;
// 升级优先级、进度图标
if
(
'PriorityIcon'
in
data
)
{
data
.
priority
=
data
.
PriorityIcon
;
delete
data
.
PriorityIcon
;
}
if
(
'ProgressIcon'
in
data
)
{
data
.
progress
=
1
+
((
data
.
ProgressIcon
-
1
)
<<
1
);
delete
data
.
ProgressIcon
;
}
// 删除过时属性
delete
data
.
point
;
delete
data
.
layout
;
});
}
switch
(
version
)
{
case
'1.1.3'
:
c_113_120
(
json
);
case
'1.2.0'
:
}
return
json
;
}
});
\ No newline at end of file
src/core/minder.data.js
View file @
053e37b4
...
...
@@ -53,6 +53,7 @@ kity.extendClass(Minder, {
json
.
template
=
this
.
getTemplate
();
json
.
theme
=
this
.
getTheme
();
json
.
version
=
KityMinder
.
version
;
if
(
protocal
)
{
return
protocal
.
encode
(
json
,
this
);
...
...
@@ -139,20 +140,10 @@ kity.extendClass(Minder, {
this
.
removeNode
(
this
.
_root
.
getChildren
()[
0
]);
}
// compality for v1.1.3
var
ocs
=
json
.
data
.
currentstyle
;
// old current-style
delete
json
.
data
.
currentstyle
;
json
=
KityMinder
.
compatibility
(
json
);
importNode
(
this
.
_root
,
json
,
this
);
if
(
ocs
==
'bottom'
)
{
json
.
template
=
'structure'
;
json
.
theme
=
'snow'
;
}
else
if
(
ocs
==
'default'
)
{
json
.
template
=
'default'
;
json
.
theme
=
'classic'
;
}
this
.
setTemplate
(
json
.
template
||
null
);
this
.
setTheme
(
json
.
theme
||
null
);
this
.
refresh
();
...
...
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