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
3719ebde
Commit
3719ebde
authored
Jul 22, 2015
by
张博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add decodeData in data.js
parent
40f51378
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
9 deletions
+77
-9
bower.json
bower.json
+1
-1
kityminder.core.js
dist/kityminder.core.js
+33
-2
kityminder.core.min.js
dist/kityminder.core.min.js
+5
-5
data.js
src/core/data.js
+38
-1
No files found.
bower.json
View file @
3719ebde
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"name"
:
"kityminder-core"
,
"name"
:
"kityminder-core"
,
"title"
:
"Kity Minder Core"
,
"title"
:
"Kity Minder Core"
,
"description"
:
"Powerful online mind graphic visualization and editor (command based)"
,
"description"
:
"Powerful online mind graphic visualization and editor (command based)"
,
"version"
:
"1.4.1
0
"
,
"version"
:
"1.4.1
1
"
,
"main"
:
[
"main"
:
[
"release/kityminder.core.min.js"
,
"release/kityminder.core.min.js"
,
"release/kityminder.core.css"
"release/kityminder.core.css"
...
...
dist/kityminder.core.js
View file @
3719ebde
/*!
/*!
* ====================================================
* ====================================================
* kityminder - v1.4.1 - 2015-07-
10
* kityminder - v1.4.1 - 2015-07-
22
* https://github.com/fex-team/kityminder-core
* https://github.com/fex-team/kityminder-core
* GitHub: https://github.com/fex-team/kityminder-core.git
* GitHub: https://github.com/fex-team/kityminder-core.git
* Copyright (c) 2015 Baidu FEX; Licensed MIT
* Copyright (c) 2015 Baidu FEX; Licensed MIT
...
@@ -827,7 +827,7 @@ _p[11] = {
...
@@ -827,7 +827,7 @@ _p[11] = {
/**
/**
* @method importData()
* @method importData()
* @for Minder
* @for Minder
* @description 使用指定的数据协议,导
出脑图数据
* @description 使用指定的数据协议,导
入脑图数据,覆盖当前实例的脑图
*
*
* @grammar importData(protocol, callback) => Promise<json>
* @grammar importData(protocol, callback) => Promise<json>
*
*
...
@@ -855,6 +855,37 @@ _p[11] = {
...
@@ -855,6 +855,37 @@ _p[11] = {
minder
.
importJson
(
json
);
minder
.
importJson
(
json
);
return
json
;
return
json
;
});
});
},
/**
* @method decodeData()
* @for Minder
* @description 使用指定的数据协议,解析为脑图数据,与 importData 的区别在于:不覆盖当前实例的脑图
*
* @grammar decodeData(protocol, callback) => Promise<json>
*
* @param {string} protocol 指定的用于解析数据的数据协议(默认内置三种数据协议 `json`、`text` 和 `markdown` 的支持)
* @param {any} data 要导入的数据
*/
decodeData
:
function
(
protocolName
,
data
,
option
)
{
var
json
,
protocol
;
var
minder
=
this
;
// 指定了协议进行导入,需要检测协议是否支持
if
(
protocolName
)
{
protocol
=
protocols
[
protocolName
];
if
(
!
protocol
||
!
protocol
.
decode
)
{
return
Promise
.
reject
(
new
Error
(
"Not supported protocol:"
+
protocolName
));
}
}
var
params
=
{
local
:
data
,
protocolName
:
protocolName
,
protocol
:
protocol
};
// 导入前抛事件
this
.
_fire
(
new
MinderEvent
(
"beforeimport"
,
params
));
return
Promise
.
resolve
(
protocol
.
decode
(
data
,
this
,
option
)).
then
(
function
(
json
)
{
return
json
;
});
}
}
});
});
}
}
...
...
dist/kityminder.core.min.js
View file @
3719ebde
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/core/data.js
View file @
3719ebde
...
@@ -178,7 +178,7 @@ define(function(require, exports, module) {
...
@@ -178,7 +178,7 @@ define(function(require, exports, module) {
/**
/**
* @method importData()
* @method importData()
* @for Minder
* @for Minder
* @description 使用指定的数据协议,导
出脑图数据
* @description 使用指定的数据协议,导
入脑图数据,覆盖当前实例的脑图
*
*
* @grammar importData(protocol, callback) => Promise<json>
* @grammar importData(protocol, callback) => Promise<json>
*
*
...
@@ -211,6 +211,43 @@ define(function(require, exports, module) {
...
@@ -211,6 +211,43 @@ define(function(require, exports, module) {
minder
.
importJson
(
json
);
minder
.
importJson
(
json
);
return
json
;
return
json
;
});
});
},
/**
* @method decodeData()
* @for Minder
* @description 使用指定的数据协议,解析为脑图数据,与 importData 的区别在于:不覆盖当前实例的脑图
*
* @grammar decodeData(protocol, callback) => Promise<json>
*
* @param {string} protocol 指定的用于解析数据的数据协议(默认内置三种数据协议 `json`、`text` 和 `markdown` 的支持)
* @param {any} data 要导入的数据
*/
decodeData
:
function
(
protocolName
,
data
,
option
)
{
var
json
,
protocol
;
var
minder
=
this
;
// 指定了协议进行导入,需要检测协议是否支持
if
(
protocolName
)
{
protocol
=
protocols
[
protocolName
];
if
(
!
protocol
||
!
protocol
.
decode
)
{
return
Promise
.
reject
(
new
Error
(
'Not supported protocol:'
+
protocolName
));
}
}
var
params
=
{
local
:
data
,
protocolName
:
protocolName
,
protocol
:
protocol
};
// 导入前抛事件
this
.
_fire
(
new
MinderEvent
(
'beforeimport'
,
params
));
return
Promise
.
resolve
(
protocol
.
decode
(
data
,
this
,
option
)).
then
(
function
(
json
)
{
return
json
;
});
}
}
});
});
});
});
\ No newline at end of file
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