/**
* ext-server_moinsave.js
*
* @license MIT
*
* @copyright 2010 Alexis Deveria, 2011 MoinMoin:ReimarBauer
* adopted for moinmoins item storage. It sends in one post png and svg data
* (I agree to dual license my work to additional GPLv2 or later)
*/
import {canvg} from '../canvg/canvg.js';
export default {
name: 'server_moinsave',
async init ({$, encode64, importLocale}) {
const strings = await importLocale();
const svgEditor = this;
const svgCanvas = svgEditor.canvas;
const saveSvgAction = '/+modify';
// Create upload target (hidden iframe)
// Hiding by size instead of display to avoid FF console errors
// with `getBBox` in browser.js `supportsPathBBox_`)
/* const target = */ $(
``
).appendTo('body');
svgEditor.setCustomHandlers({
async save (win, data) {
const svg = '\n' + data;
const qstr = $.param.querystring();
const [, name] = qstr.substr(9).split('/+get/');
const svgData = encode64(svg);
if (!$('#export_canvas').length) {
$('