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
98f9f504
Commit
98f9f504
authored
Apr 11, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
publish
parent
326e819f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
24 deletions
+35
-24
kityminder.all.js
dist/kityminder.all.js
+33
-22
kityminder.all.min.js
dist/kityminder.all.min.js
+2
-2
No files found.
dist/kityminder.all.js
View file @
98f9f504
...
...
@@ -4000,6 +4000,10 @@ KityMinder.registerModule( "DragTree", function () {
KityMinder
.
registerModule
(
"DropFile"
,
function
()
{
var
social
,
draftManager
,
importing
=
false
;
function
init
()
{
var
container
=
this
.
getPaper
().
getContainer
();
container
.
addEventListener
(
'dragover'
,
onDragOver
);
...
...
@@ -4020,51 +4024,58 @@ KityMinder.registerModule( "DropFile", function () {
var
files
=
e
.
dataTransfer
.
files
;
if
(
files
)
{
var
file
=
files
[
0
];
var
ext
=
file
.
type
||
(
/
(
.
)\w
+$/
).
exec
(
file
.
name
)[
0
];
var
file
=
files
[
0
];
var
ext
=
file
.
type
||
(
/
(
.
)\w
+$/
).
exec
(
file
.
name
)[
0
];
if
(
(
/xmind/g
).
test
(
ext
)
)
{
//xmind zip
if
(
(
/xmind/g
).
test
(
ext
)
)
{
//xmind zip
importSync
(
minder
,
file
,
'xmind'
);
}
else
if
(
(
/mmap/g
).
test
(
ext
)
)
{
// mindmanager zip
}
else
if
(
(
/mmap/g
).
test
(
ext
)
)
{
// mindmanager zip
importSync
(
minder
,
file
,
'mindmanager'
);
}
else
if
(
(
/mm/g
).
test
(
ext
)
)
{
//freemind xml
}
else
if
(
(
/mm/g
).
test
(
ext
)
)
{
//freemind xml
importAsync
(
minder
,
file
,
'freemind'
);
}
else
{
// txt json
}
else
{
// txt json
importAsync
(
minder
,
file
);
}
}
}
function
afterImport
()
{
if
(
!
importing
)
return
;
createDraft
(
this
);
social
.
setRemotePath
(
null
,
false
);
this
.
execCommand
(
'camera'
,
this
.
getRoot
()
);
setTimeout
(
function
()
{
social
.
watchChanges
(
true
);
},
10
);
importing
=
false
;
}
// 同步加载文件
function
importSync
(
minder
,
file
,
protocal
){
minder
.
importData
(
file
,
protocal
);
//zip文件的import是同步的
manageDraft
(
minder
);
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
function
importSync
(
minder
,
file
,
protocal
)
{
social
=
social
||
window
.
social
;
social
.
watchChanges
(
false
);
importing
=
true
;
minder
.
importData
(
file
,
protocal
);
//zip文件的import是同步的
}
// 异步加载文件
function
importAsync
(
minder
,
file
,
protocal
){
function
importAsync
(
minder
,
file
,
protocal
)
{
var
reader
=
new
FileReader
();
reader
.
onload
=
function
(
e
)
{
minder
.
importData
(
e
.
target
.
result
,
protocal
);
//纯文本文件的import是同步的
manageDraft
(
minder
);
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
importSync
(
minder
,
e
.
target
.
result
,
protocal
);
};
reader
.
readAsText
(
file
);
}
function
manageDraft
(
minder
){
if
(
!
window
.
draftManager
){
window
.
draftManager
=
new
window
.
DraftManager
(
minder
);
}
window
.
draftManager
.
create
();
function
createDraft
(
minder
)
{
draftManager
=
window
.
draftManager
;
draftManager
.
create
();
}
return
{
events
:
{
ready
:
init
'ready'
:
init
,
'import'
:
afterImport
}
};
}
);
...
...
dist/kityminder.all.min.js
View file @
98f9f504
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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