From 03d4e22442c6d445bda2c7827e973d5ec854e81a Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 30 Dec 2021 22:25:25 -0800 Subject: [PATCH] Add download on editor --- packages/mindplot/src/components/widget/Menu.js | 11 +++++++---- .../test/playground/map-render/html/editor.html | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/mindplot/src/components/widget/Menu.js b/packages/mindplot/src/components/widget/Menu.js index fb73d864..40452ac1 100644 --- a/packages/mindplot/src/components/widget/Menu.js +++ b/packages/mindplot/src/components/widget/Menu.js @@ -212,12 +212,15 @@ class Menu extends IMenu { } this._addButton('export', false, false, () => { - // BootstrapDialogRequest.active = new BootstrapDialogRequest(`c/maps/${mapId}/exportf`, $msg('EXPORT'), { - // cancelButton: true, - // closeButton: true, - // }); const svgContent = designer.export('svg'); console.log(svgContent); + + const anchor = $('#export_anchor'); + anchor.attr('download', `${mapId}.svg`); + // anchor.attr('href', `data:image/svg+xml;base64,${btoa(svgContent)}`); + anchor.attr('href', 'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/svg.svg'); + + anchor.click(); }); Menu._registerTooltip('export', $msg('EXPORT')); diff --git a/packages/mindplot/test/playground/map-render/html/editor.html b/packages/mindplot/test/playground/map-render/html/editor.html index 1418b1b8..faee12bf 100644 --- a/packages/mindplot/test/playground/map-render/html/editor.html +++ b/packages/mindplot/test/playground/map-render/html/editor.html @@ -38,6 +38,7 @@
+