Fix data:image/svg link loading for imagelib extension; fix server_opensave-extension-opened SVG files for older browsers; leverage utilities base 64 encoding in place of btoa also in server_opensave extension

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2614 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2013-10-29 06:33:37 +00:00
parent a0d485d336
commit c3c98033b6
2 changed files with 5 additions and 5 deletions

View File

@ -131,7 +131,7 @@ svgEditor.addExtension("imagelib", function() {
if(response.indexOf('data:image/svg+xml') === 0) {
var pre = 'data:image/svg+xml;base64,';
var src = response.substring(pre.length);
response = svgCanvas.Utils.decode64(src);
response = svgedit.utilities.decode64(src);
svg_str = true;
break;
} else if(response.indexOf('data:image/') === 0) {
@ -141,7 +141,7 @@ svgEditor.addExtension("imagelib", function() {
// Else fall through
default:
// TODO: See if there's a way to base64 encode the binary data stream
// var str = 'data:;base64,' + svgCanvas.Utils.encode64(response, true);
// var str = 'data:;base64,' + svgedit.utilities.encode64(response, true);
// Assume it's raw image data
// importImage(str);

View File

@ -38,7 +38,7 @@ svgEditor.addExtension("server_opensave", {
filename = getFileNameFromTitle();
//if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml,' + encodeURI(data))) { // Firefox limits size of file
if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;base64,' + window.btoa(data))) {
if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;base64,' + svgedit.utilities.encode64(data))) {
return;
}
@ -119,9 +119,9 @@ svgEditor.addExtension("server_opensave", {
}
$('#dialog_box').hide();
if (type !== 'import_img') {
xmlstr = svgCanvas.Utils.decode64(str64);
xmlstr = svgedit.utilities.decode64(str64);
}
switch (type) {