diff --git a/CHANGES.md b/CHANGES.md index 70542aba..805166a1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ PDF as export (#273 @cuixiping); fixes #124 and #254 - Fix (image import): Put src after onload to avoid missing event; check other width/height properties in case offset is 0; fixes #278 +- Fix (image export) Export in Chrome; fixes #282 - npm: Update devDeps - npm: Point to official sinon-test package now that ES6 Modules support landed diff --git a/editor/canvg/canvg.js b/editor/canvg/canvg.js index a13aab69..fadf9164 100644 --- a/editor/canvg/canvg.js +++ b/editor/canvg/canvg.js @@ -2745,6 +2745,7 @@ function build (opts) { }; svg.loadXmlDoc = function (ctx, dom) { + let res; svg.init(ctx); const mapXY = function (p) { @@ -2888,7 +2889,7 @@ function build (opts) { // render if needed if (needUpdate) { - draw(); + draw(res); svg.Mouse.runEvents(); // run and clear our events } }, 1000 / svg.FRAMERATE); @@ -2896,7 +2897,9 @@ function build (opts) { if (svg.ImagesLoaded()) { waitingForImages = false; draw(resolve); + return; } + res = resolve; }); }; diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 19d1a140..1095829b 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -4177,7 +4177,7 @@ editor.init = function () { // 'ICO', // Todo: Find a way to preserve transparency in SVG-Edit if not working presently and do full packaging for x-icon; then switch back to position after 'PNG' 'PNG', 'JPEG', 'BMP', 'WEBP', 'PDF' - ], function (imgType) { // todo: replace hard-coded msg with uiStrings.notification. + ], async function (imgType) { // todo: replace hard-coded msg with uiStrings.notification. if (!imgType) { return; } @@ -4210,17 +4210,18 @@ editor.init = function () { } exportWindow = window.open(popURL, exportWindowName); } + const chrome = isChrome(); if (imgType === 'PDF') { - if (!customExportPDF && !isChrome()) { + if (!customExportPDF && !chrome) { openExportWindow(); } - svgCanvas.exportPDF(exportWindowName, isChrome() ? 'save' : undefined); + svgCanvas.exportPDF(exportWindowName, chrome ? 'save' : undefined); } else { if (!customExportImage) { openExportWindow(); } const quality = parseInt($('#image-slider').val(), 10) / 100; - svgCanvas.rasterExport(imgType, quality, exportWindowName); + /* const results = */ await svgCanvas.rasterExport(imgType, quality, exportWindowName); } }, function () { const sel = $(this);