Add download on editor

This commit is contained in:
Paulo Gustavo Veiga 2021-12-30 22:25:25 -08:00
parent f8b424e823
commit 03d4e22442
2 changed files with 8 additions and 4 deletions

View File

@ -212,12 +212,15 @@ class Menu extends IMenu {
} }
this._addButton('export', false, false, () => { this._addButton('export', false, false, () => {
// BootstrapDialogRequest.active = new BootstrapDialogRequest(`c/maps/${mapId}/exportf`, $msg('EXPORT'), {
// cancelButton: true,
// closeButton: true,
// });
const svgContent = designer.export('svg'); const svgContent = designer.export('svg');
console.log(svgContent); 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')); Menu._registerTooltip('export', $msg('EXPORT'));

View File

@ -38,6 +38,7 @@
<div id="export" class="buttonOn"> <div id="export" class="buttonOn">
<img src="images/export.svg" /> <img src="images/export.svg" />
</div> </div>
<a id="export_anchor" href="" download=""></a>
</div> </div>
<div id="edit" class="buttonContainer"> <div id="edit" class="buttonContainer">
<div id="undoEdition" class="buttonOn"> <div id="undoEdition" class="buttonOn">