Sync with SVG-Edit

This commit is contained in:
Jacques Distler 2010-09-10 15:19:23 -05:00
parent e99fcf720c
commit e5ca66ae41
17 changed files with 1962 additions and 467 deletions

View file

@ -18,7 +18,7 @@ svgEditor.addExtension("server_opensave", {
svgEditor.setCustomHandlers({
save: function(win, data) {
var svg = "<?xml version='1.0'?>\n" + data;
var svg = "<?xml version=\"1.0\"?>\n" + data;
var title = svgCanvas.getDocumentTitle();
var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
@ -42,33 +42,34 @@ svgEditor.addExtension("server_opensave", {
c.width = svgCanvas.contentW;
c.height = svgCanvas.contentH;
canvg(c, data.svg);
var datauri = c.toDataURL('image/png');
var uiStrings = svgEditor.uiStrings;
var note = '';
// Check if there's issues
if(issues.length) {
var pre = "\n \u2022 ";
note += ("\n\n" + pre + issues.join(pre));
}
if(note.length) {
alert(note);
}
var title = svgCanvas.getDocumentTitle();
var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
var form = $('<form>').attr({
method: 'post',
action: save_png_action,
target: 'output_frame'
}) .append('<input type="hidden" name="output_png" value="' + datauri + '">')
.append('<input type="hidden" name="filename" value="' + filename + '">')
.appendTo('body')
.submit().remove();
canvg(c, data.svg, {renderCallback: function() {
var datauri = c.toDataURL('image/png');
var uiStrings = svgEditor.uiStrings;
var note = '';
// Check if there's issues
if(issues.length) {
var pre = "\n \u2022 ";
note += ("\n\n" + pre + issues.join(pre));
}
if(note.length) {
alert(note);
}
var title = svgCanvas.getDocumentTitle();
var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
var form = $('<form>').attr({
method: 'post',
action: save_png_action,
target: 'output_frame'
}) .append('<input type="hidden" name="output_png" value="' + datauri + '">')
.append('<input type="hidden" name="filename" value="' + filename + '">')
.appendTo('body')
.submit().remove();
}});
}