mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-23 15:36:52 +00:00
Fix saving SVG images
This commit is contained in:
parent
2c271077aa
commit
c9ce9b192d
@ -58,6 +58,14 @@ exports.startup = function() {
|
|||||||
}
|
}
|
||||||
// Save the tiddler
|
// Save the tiddler
|
||||||
if(params["save-title"]) {
|
if(params["save-title"]) {
|
||||||
|
if(dataUrl.indexOf("data:image/svg+xml;") === 0) {
|
||||||
|
var commaIndex = dataUrl.indexOf(",");
|
||||||
|
$tw.wiki.addTiddler(new $tw.Tiddler({
|
||||||
|
title: params["save-title"],
|
||||||
|
type: "image/svg+xml",
|
||||||
|
"text": decodeURIComponent(dataUrl.substring(commaIndex + 1))
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
var parts = dataUrl.split(";base64,");
|
var parts = dataUrl.split(";base64,");
|
||||||
$tw.wiki.addTiddler(new $tw.Tiddler({
|
$tw.wiki.addTiddler(new $tw.Tiddler({
|
||||||
title: params["save-title"],
|
title: params["save-title"],
|
||||||
@ -65,6 +73,7 @@ exports.startup = function() {
|
|||||||
"text": parts[1]
|
"text": parts[1]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
console.error('oops, something went wrong!', error);
|
console.error('oops, something went wrong!', error);
|
||||||
|
Loading…
Reference in New Issue
Block a user