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
c6f94031
Commit
c6f94031
authored
Apr 15, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed svg download bug
parent
bebae1e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
83 deletions
+88
-83
LICENSE
LICENSE
+23
-16
saveto.js
src/adapter/saveto.js
+3
-4
mindmanager.js
src/protocal/mindmanager.js
+60
-61
png.js
src/protocal/png.js
+2
-2
No files found.
LICENSE
View file @
c6f94031
The MIT License (MIT)
Copyright (c) 2014, FEX,Baidu.
All rights reserved.
Copyright (c) 2013 KityMinder
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Neither the name of the {organization} nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
src/adapter/saveto.js
View file @
c6f94031
...
...
@@ -39,12 +39,11 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
var
data
=
me
.
exportData
(
res
.
value
);
console
.
log
(
data
);
var
p
=
KityMinder
.
findProtocal
(
res
.
value
);
var
filename
=
me
.
getMinderTitle
()
+
p
.
fileExtension
;
if
(
p
.
fileExtension
===
''
)
{
}
else
if
(
typeof
(
data
)
==
'string'
)
{
var
url
=
'data:text/plain; utf-8,'
+
encodeURI
(
data
);
if
(
typeof
(
data
)
==
'string'
)
{
var
url
=
'data:text/plain; utf-8,'
+
encodeURIComponent
(
data
);
doDownload
(
url
,
filename
);
}
else
if
(
data
&&
data
.
then
)
{
data
.
then
(
function
(
url
)
{
...
...
src/protocal/mindmanager.js
View file @
c6f94031
...
...
@@ -10,97 +10,96 @@ KityMinder.registerProtocal( 'mindmanager', function () {
// 标签 map
var
markerMap
=
{
'urn:mindjet:Prio1'
:
[
'PriorityIcon'
,
1
]
,
'urn:mindjet:Prio2'
:
[
'PriorityIcon'
,
2
]
,
'urn:mindjet:Prio3'
:
[
'PriorityIcon'
,
3
]
,
'urn:mindjet:Prio4'
:
[
'PriorityIcon'
,
4
]
,
'urn:mindjet:Prio5'
:
[
'PriorityIcon'
,
5
]
,
'0'
:
[
'ProgressIcon'
,
1
]
,
'25'
:
[
'ProgressIcon'
,
2
]
,
'50'
:
[
'ProgressIcon'
,
3
]
,
'75'
:
[
'ProgressIcon'
,
4
]
,
'100'
:
[
'ProgressIcon'
,
5
]
'urn:mindjet:Prio1'
:
[
'PriorityIcon'
,
1
],
'urn:mindjet:Prio2'
:
[
'PriorityIcon'
,
2
],
'urn:mindjet:Prio3'
:
[
'PriorityIcon'
,
3
],
'urn:mindjet:Prio4'
:
[
'PriorityIcon'
,
4
],
'urn:mindjet:Prio5'
:
[
'PriorityIcon'
,
5
],
'0'
:
[
'ProgressIcon'
,
1
],
'25'
:
[
'ProgressIcon'
,
2
],
'50'
:
[
'ProgressIcon'
,
3
],
'75'
:
[
'ProgressIcon'
,
4
],
'100'
:
[
'ProgressIcon'
,
5
]
};
function
processTopic
(
topic
,
obj
)
{
function
processTopic
(
topic
,
obj
)
{
//处理文本
obj
.
data
=
{
text
:
topic
.
Text
&&
topic
.
Text
.
PlainText
||
''
};
// 节点默认的文本,没有Text属性
obj
.
data
=
{
text
:
topic
.
Text
&&
topic
.
Text
.
PlainText
||
''
};
// 节点默认的文本,没有Text属性
// 处理标签
if
(
topic
.
Task
)
{
if
(
topic
.
Task
)
{
var
type
;
if
(
topic
.
Task
.
TaskPriority
)
{
if
(
topic
.
Task
.
TaskPriority
)
{
type
=
markerMap
[
topic
.
Task
.
TaskPriority
];
type
&&
(
obj
.
data
[
type
[
0
]
]
=
type
[
1
]
);
type
&&
(
obj
.
data
[
type
[
0
]
]
=
type
[
1
]
);
}
if
(
topic
.
Task
.
TaskPercentage
)
{
if
(
topic
.
Task
.
TaskPercentage
)
{
type
=
markerMap
[
topic
.
Task
.
TaskPercentage
];
type
&&
(
obj
.
data
[
type
[
0
]
]
=
type
[
1
]
);
type
&&
(
obj
.
data
[
type
[
0
]
]
=
type
[
1
]
);
}
}
//处理子节点
if
(
topic
.
SubTopics
&&
topic
.
SubTopics
.
Topic
)
{
if
(
topic
.
SubTopics
&&
topic
.
SubTopics
.
Topic
)
{
var
tmp
=
topic
.
SubTopics
.
Topic
;
if
(
tmp
.
length
&&
tmp
.
length
>
0
)
{
//多个子节点
if
(
tmp
.
length
&&
tmp
.
length
>
0
)
{
//多个子节点
obj
.
children
=
[];
for
(
var
i
in
tmp
)
{
obj
.
children
.
push
(
{}
);
processTopic
(
tmp
[
i
],
obj
.
children
[
i
]
);
for
(
var
i
in
tmp
)
{
obj
.
children
.
push
(
{}
);
processTopic
(
tmp
[
i
],
obj
.
children
[
i
]
);
}
}
else
{
//一个子节点
obj
.
children
=
[
{}
];
processTopic
(
tmp
,
obj
.
children
[
0
]
);
}
else
{
//一个子节点
obj
.
children
=
[
{}
];
processTopic
(
tmp
,
obj
.
children
[
0
]
);
}
}
}
function
xml2km
(
xml
)
{
var
json
=
$
.
xml2json
(
xml
);
function
xml2km
(
xml
)
{
var
json
=
$
.
xml2json
(
xml
);
var
result
=
{};
processTopic
(
json
.
OneTopic
.
Topic
,
result
);
processTopic
(
json
.
OneTopic
.
Topic
,
result
);
return
result
;
}
function
getEntries
(
file
,
onend
)
{
zip
.
createReader
(
new
zip
.
BlobReader
(
file
),
function
(
zipReader
)
{
zipReader
.
getEntries
(
onend
);
},
onerror
);
function
getEntries
(
file
,
onend
)
{
zip
.
createReader
(
new
zip
.
BlobReader
(
file
),
function
(
zipReader
)
{
zipReader
.
getEntries
(
onend
);
},
onerror
);
}
return
{
fileDescription
:
'mindmanager格式文件'
,
fileExtension
:
'.mmap'
,
decode
:
function
(
local
)
{
return
{
then
:
function
(
local
,
callback
){
getEntries
(
local
,
function
(
entries
)
{
entries
.
forEach
(
function
(
entry
)
{
if
(
entry
.
filename
==
'Document.xml'
){
entry
.
getData
(
new
zip
.
TextWriter
(),
function
(
text
)
{
var
km
=
xml2km
(
$
.
parseXML
(
text
));
callback
&&
callback
(
km
);
});
}
});
});
}
};
},
// recognize: recognize,
recognizePriority
:
-
1
};
}
);
return
{
fileDescription
:
'mindmanager格式文件'
,
fileExtension
:
'.mmap'
,
decode
:
function
(
local
)
{
return
{
then
:
function
(
local
,
callback
)
{
getEntries
(
local
,
function
(
entries
)
{
entries
.
forEach
(
function
(
entry
)
{
if
(
entry
.
filename
==
'Document.xml'
)
{
entry
.
getData
(
new
zip
.
TextWriter
(),
function
(
text
)
{
var
km
=
xml2km
(
$
.
parseXML
(
text
)
);
callback
&&
callback
(
km
);
}
);
}
}
);
}
);
}
};
},
// recognize: recognize,
recognizePriority
:
-
1
};
}
);
\ No newline at end of file
src/protocal/png.js
View file @
c6f94031
...
...
@@ -42,10 +42,10 @@ KityMinder.registerProtocal( "png", function () {
}
);
// need a xml with width and height
svgXml
=
$
(
'<div></div'
).
append
(
$svg
).
html
();
svgXml
=
$
(
'<div></div
>
'
).
append
(
$svg
).
html
();
// svg 含有 符号导出报错 Entity 'nbsp' not defined
svgXml
=
svgXml
.
replace
(
/ /g
,
' '
);
svgXml
=
svgXml
.
replace
(
/ /g
,
' '
);
blob
=
new
Blob
(
[
svgXml
],
{
type
:
"image/svg+xml;charset=utf-8"
...
...
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