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
8b8b65c9
Commit
8b8b65c9
authored
May 27, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix download bug in chrome 35.0.1916.114
parent
60272950
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
3 deletions
+8
-3
saveto.js
src/adapter/saveto.js
+4
-2
json.js
src/protocal/json.js
+1
-0
plain.js
src/protocal/plain.js
+1
-0
png.js
src/protocal/png.js
+1
-1
svg.js
src/protocal/svg.js
+1
-0
No files found.
src/adapter/saveto.js
View file @
8b8b65c9
...
@@ -35,6 +35,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -35,6 +35,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
var
a
=
document
.
createElement
(
'a'
);
var
a
=
document
.
createElement
(
'a'
);
a
.
setAttribute
(
'download'
,
filename
);
a
.
setAttribute
(
'download'
,
filename
);
a
.
setAttribute
(
'href'
,
url
);
a
.
setAttribute
(
'href'
,
url
);
document
.
body
.
appendChild
(
a
);
var
evt
;
var
evt
;
try
{
try
{
evt
=
new
MouseEvent
(
'click'
);
evt
=
new
MouseEvent
(
'click'
);
...
@@ -43,6 +44,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -43,6 +44,7 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
evt
.
initEvent
(
'click'
,
true
,
true
);
evt
.
initEvent
(
'click'
,
true
,
true
);
}
}
a
.
dispatchEvent
(
evt
);
a
.
dispatchEvent
(
evt
);
document
.
body
.
removeChild
(
a
);
}
}
var
ie_ver
=
function
()
{
var
ie_ver
=
function
()
{
...
@@ -63,14 +65,14 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -63,14 +65,14 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
iframe
.
contentDocument
.
writeln
(
d
);
iframe
.
contentDocument
.
writeln
(
d
);
iframe
.
contentDocument
.
execCommand
(
'saveas'
,
''
,
filename
);
iframe
.
contentDocument
.
execCommand
(
'saveas'
,
''
,
filename
);
};
};
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
var
data
=
me
.
exportData
(
res
.
value
);
var
data
=
me
.
exportData
(
res
.
value
);
var
p
=
KityMinder
.
findProtocal
(
res
.
value
);
var
p
=
KityMinder
.
findProtocal
(
res
.
value
);
var
filename
=
me
.
getMinderTitle
()
+
p
.
fileExtension
;
var
filename
=
me
.
getMinderTitle
()
+
p
.
fileExtension
;
if
(
typeof
(
data
)
==
'string'
)
{
if
(
typeof
(
data
)
==
'string'
)
{
var
url
=
'data:
text/plain
; utf-8,'
+
encodeURIComponent
(
data
);
var
url
=
'data:
'
+
(
p
.
mineType
||
'text/plain'
)
+
'
; utf-8,'
+
encodeURIComponent
(
data
);
if
(
ie_ver
()
>
0
)
{
if
(
ie_ver
()
>
0
)
{
//console.log( p.fileExtension );
if
(
p
.
fileExtension
===
'.km'
)
{
if
(
p
.
fileExtension
===
'.km'
)
{
doSave
(
'application/x-javascript'
,
data
,
me
.
getMinderTitle
()
);
doSave
(
'application/x-javascript'
,
data
,
me
.
getMinderTitle
()
);
}
else
if
(
p
.
fileExtension
===
'.svg'
)
{
}
else
if
(
p
.
fileExtension
===
'.svg'
)
{
...
...
src/protocal/json.js
View file @
8b8b65c9
...
@@ -8,6 +8,7 @@ KityMinder.registerProtocal( 'json', function () {
...
@@ -8,6 +8,7 @@ KityMinder.registerProtocal( 'json', function () {
return
{
return
{
fileDescription
:
'KityMinder'
,
fileDescription
:
'KityMinder'
,
fileExtension
:
'.km'
,
fileExtension
:
'.km'
,
mineType
:
'application/json'
,
encode
:
function
(
json
)
{
encode
:
function
(
json
)
{
return
JSON
.
stringify
(
json
,
filter
);
return
JSON
.
stringify
(
json
,
filter
);
},
},
...
...
src/protocal/plain.js
View file @
8b8b65c9
...
@@ -87,6 +87,7 @@ KityMinder.registerProtocal( "plain", function () {
...
@@ -87,6 +87,7 @@ KityMinder.registerProtocal( "plain", function () {
return
{
return
{
fileDescription
:
'大纲文本'
,
fileDescription
:
'大纲文本'
,
fileExtension
:
'.txt'
,
fileExtension
:
'.txt'
,
mineType
:
'text/plain'
,
encode
:
function
(
json
)
{
encode
:
function
(
json
)
{
return
encode
(
json
,
0
);
return
encode
(
json
,
0
);
},
},
...
...
src/protocal/png.js
View file @
8b8b65c9
...
@@ -72,7 +72,7 @@ KityMinder.registerProtocal( "png", function () {
...
@@ -72,7 +72,7 @@ KityMinder.registerProtocal( "png", function () {
function
generateDataUrl
(
canvas
)
{
function
generateDataUrl
(
canvas
)
{
var
url
=
canvas
.
toDataURL
(
'png'
);
var
url
=
canvas
.
toDataURL
(
'png'
);
return
url
.
replace
(
'image/png'
,
'image/octet-stream'
)
;
return
url
;
}
}
loadImage
(
url
,
function
()
{
loadImage
(
url
,
function
()
{
var
svgImage
=
this
;
var
svgImage
=
this
;
...
...
src/protocal/svg.js
View file @
8b8b65c9
...
@@ -2,6 +2,7 @@ KityMinder.registerProtocal( "svg", function () {
...
@@ -2,6 +2,7 @@ KityMinder.registerProtocal( "svg", function () {
return
{
return
{
fileDescription
:
'SVG 矢量图(暂不支持IE)'
,
fileDescription
:
'SVG 矢量图(暂不支持IE)'
,
fileExtension
:
'.svg'
,
fileExtension
:
'.svg'
,
mineType
:
'image/svg+xml'
,
encode
:
function
(
json
,
km
)
{
encode
:
function
(
json
,
km
)
{
// svg 含有 符号导出报错 Entity 'nbsp' not defined
// svg 含有 符号导出报错 Entity 'nbsp' not defined
return
km
.
getPaper
().
container
.
innerHTML
.
replace
(
/ /g
,
' '
);
return
km
.
getPaper
().
container
.
innerHTML
.
replace
(
/ /g
,
' '
);
...
...
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