Ensure all dependencies available for canvg-using extensions (server_moinsave, server_opensave)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2849 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Brett Zamir 2014-05-22 02:56:00 +00:00
parent 905dac6979
commit 73a4804324
2 changed files with 36 additions and 36 deletions

View File

@ -32,7 +32,7 @@ svgEditor.addExtension("server_opensave", {
var c = $('#export_canvas')[0];
c.width = svgCanvas.contentW;
c.height = svgCanvas.contentH;
$.getScript('canvg/canvg.js', function() {
svgEditor.buildCanvgCallback(function () {
canvg(c, svg, {renderCallback: function() {
var datauri = c.toDataURL('image/png');
// var uiStrings = svgEditor.uiStrings;
@ -48,7 +48,7 @@ svgEditor.addExtension("server_opensave", {
.appendTo('body')
.submit().remove();
}});
});
})();
alert("Saved! Return to Item View!");
top.window.location = '/'+name;
}

View File

@ -68,41 +68,41 @@ svgEditor.addExtension("server_opensave", {
c.width = svgCanvas.contentW;
c.height = svgCanvas.contentH;
canvg(c, data.svg, {renderCallback: function() {
var pre, filename, suffix,
datauri = quality ? c.toDataURL(mimeType, quality) : c.toDataURL(mimeType),
// uiStrings = svgEditor.uiStrings,
note = '';
svgEditor.buildCanvgCallback(function () {
canvg(c, data.svg, {renderCallback: function() {
var pre, filename, suffix,
datauri = quality ? c.toDataURL(mimeType, quality) : c.toDataURL(mimeType),
// uiStrings = svgEditor.uiStrings,
note = '';
// Check if there are issues
if (issues.length) {
pre = "\n \u2022 ";
note += ("\n\n" + pre + issues.join(pre));
}
// Check if there are issues
if (issues.length) {
pre = "\n \u2022 ";
note += ("\n\n" + pre + issues.join(pre));
}
if(note.length) {
alert(note);
}
if(note.length) {
alert(note);
}
filename = getFileNameFromTitle();
suffix = '.' + data.type.toLowerCase();
if (clientDownloadSupport(filename, suffix, datauri)) {
return;
}
$('<form>').attr({
method: 'post',
action: save_img_action,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">')
.append('<input type="hidden" name="mime" value="' + mimeType + '">')
.append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">')
.appendTo('body')
.submit().remove();
}});
filename = getFileNameFromTitle();
suffix = '.' + data.type.toLowerCase();
if (clientDownloadSupport(filename, suffix, datauri)) {
return;
}
$('<form>').attr({
method: 'post',
action: save_img_action,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">')
.append('<input type="hidden" name="mime" value="' + mimeType + '">')
.append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">')
.appendTo('body')
.submit().remove();
}});
})();
}
});