Added timeout to PNG export for server_opensave extension
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1669 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
1ef6188da3
commit
3130f85ac6
|
@ -43,32 +43,36 @@ 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 = '';
|
||||
// Timeout to allow canvg to run a bit
|
||||
setTimeout(function() {
|
||||
var datauri = c.toDataURL('image/png');
|
||||
|
||||
// Check if there's issues
|
||||
if(issues.length) {
|
||||
var pre = "\n \u2022 ";
|
||||
note += ("\n\n" + pre + issues.join(pre));
|
||||
}
|
||||
var uiStrings = svgEditor.uiStrings;
|
||||
var note = '';
|
||||
|
||||
if(note.length) {
|
||||
alert(note);
|
||||
}
|
||||
// Check if there's issues
|
||||
if(issues.length) {
|
||||
var pre = "\n \u2022 ";
|
||||
note += ("\n\n" + pre + issues.join(pre));
|
||||
}
|
||||
|
||||
var title = svgCanvas.getDocumentTitle();
|
||||
var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
|
||||
if(note.length) {
|
||||
alert(note);
|
||||
}
|
||||
|
||||
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();
|
||||
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();
|
||||
}, 1000);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue