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
942c1972
Commit
942c1972
authored
Oct 21, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add free mind support
parent
dc0d874f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
3 deletions
+54
-3
kity
lib/kity
+1
-1
freemind.js
src/protocol/freemind.js
+49
-2
xmind.js
src/protocol/xmind.js
+2
-0
download.js
ui/menu/save/download.js
+2
-0
No files found.
kity
@
95da8132
Subproject commit
8f52e73cc57a447f268e71783d44e34ee028f763
Subproject commit
95da81322148afe2f03c632777148feba75e918e
src/protocol/freemind.js
View file @
942c1972
...
...
@@ -88,8 +88,55 @@ KityMinder.registerProtocol('freemind', function(minder) {
});
},
// 不支持
encode
:
null
encode
:
function
(
json
,
km
,
options
)
{
var
url
=
'native-support/export.php'
;
var
data
=
JSON
.
stringify
(
json
);
function
fetch
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
xhr
=
new
XMLHttpRequest
();
xhr
.
responseType
=
'blob'
;
xhr
.
onload
=
resolve
;
xhr
.
onerror
=
reject
;
xhr
.
open
(
'POST'
,
url
);
var
form
=
new
FormData
();
form
.
append
(
'type'
,
'freemind'
);
form
.
append
(
'data'
,
data
);
xhr
.
send
(
form
);
}).
then
(
function
(
e
)
{
return
e
.
target
.
response
;
});
}
function
download
()
{
var
filename
=
options
.
filename
||
'freemind.mm'
;
var
form
=
document
.
createElement
(
'form'
);
form
.
setAttribute
(
'action'
,
url
);
form
.
setAttribute
(
'method'
,
'POST'
);
form
.
appendChild
(
field
(
'filename'
,
filename
));
form
.
appendChild
(
field
(
'type'
,
'freemind'
));
form
.
appendChild
(
field
(
'data'
,
data
));
form
.
appendChild
(
field
(
'download'
,
'1'
));
form
.
submit
();
function
field
(
name
,
content
)
{
var
input
=
document
.
createElement
(
'input'
);
input
.
type
=
'hidden'
;
input
.
name
=
name
;
input
.
value
=
content
;
return
input
;
}
}
if
(
options
&&
options
.
download
)
{
return
download
();
}
else
{
return
fetch
();
}
}
};
});
\ No newline at end of file
src/protocol/xmind.js
View file @
942c1972
...
...
@@ -179,6 +179,8 @@ KityMinder.registerProtocol('xmind', function(minder) {
}
}
return
download
();
if
(
options
&&
options
.
download
)
{
return
download
();
}
else
{
...
...
ui/menu/save/download.js
View file @
942c1972
...
...
@@ -56,6 +56,8 @@ KityMinder.registerUI('menu/save/download', function(minder) {
minder
.
exportData
(
protocol
.
name
,
options
).
then
(
function
(
data
)
{
if
(
protocol
.
name
==
'freemind'
)
return
;
switch
(
protocol
.
dataType
)
{
case
'text'
:
return
doDownload
(
buildDataUrl
(
mineType
,
data
),
filename
,
'text'
);
...
...
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