/* globals jQuery */ /* * ext-server_opensave.js * * Licensed under the MIT License * * Copyright(c) 2010 Alexis Deveria * */ import svgEditor from '../svg-editor.js'; svgEditor.addExtension('server_opensave', { callback ({canvg, decode64, encode64, buildCanvgCallback}) { const $ = jQuery; const svgCanvas = svgEditor.canvas; function getFileNameFromTitle () { const title = svgCanvas.getDocumentTitle(); // We convert (to underscore) only those disallowed Win7 file name characters return title.trim().replace(/[/\\:*?"<>|]/g, '_'); } function xhtmlEscape (str) { return str.replace(/&(?!amp;)/g, '&').replace(/"/g, '"').replace(/')[0].download === ''; let a; if (support) { a = $('hidden').attr({ download: (filename || 'image') + suffix, href: uri }).css('display', 'none').appendTo('body'); a[0].click(); return true; } } const saveSvgAction = svgEditor.curConfig.extPath + 'filesave.php', saveImgAction = svgEditor.curConfig.extPath + 'filesave.php'; // Create upload target (hidden iframe) let cancelled = false; $('