- Refactoring: Destructuring, templates, label Unicode code point

- npm: Rename `build-doc` to `build-docs`; add `open-docs` script
This commit is contained in:
Brett Zamir
2019-04-08 10:50:50 +08:00
parent 91c0dc549b
commit 0c1ddd44fa
18 changed files with 290 additions and 243 deletions

View File

@@ -8,7 +8,8 @@ var svgEditorExtension_php_savefile = (function () {
init: function init(_ref) {
var $ = _ref.$;
var svgEditor = this;
var svgCanvas = svgEditor.canvas;
var extPath = svgEditor.curConfig.extPath,
svgCanvas = svgEditor.canvas;
/**
* Get file name out of SVGEdit document title.
* @returns {string}
@@ -19,7 +20,7 @@ var svgEditorExtension_php_savefile = (function () {
return title.trim();
}
var saveSvgAction = svgEditor.curConfig.extPath + 'savefile.php';
var saveSvgAction = extPath + 'savefile.php';
svgEditor.setCustomHandlers({
save: function save(win, data) {
var svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data,

View File

@@ -4893,14 +4893,15 @@ var svgEditorExtension_server_moinsave = (function () {
var _save = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee(win, data) {
var svg, qstr, name, svgData, c, datauri, pngData;
var svg, qstr, _qstr$substr$split, _qstr$substr$split2, name, svgData, c, datauri, pngData;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
svg = '<?xml version="1.0"?>\n' + data;
qstr = $.param.querystring();
name = qstr.substr(9).split('/+get/')[1];
_qstr$substr$split = qstr.substr(9).split('/+get/'), _qstr$substr$split2 = _slicedToArray(_qstr$substr$split, 2), name = _qstr$substr$split2[1];
svgData = encode64(svg);
if (!$('#export_canvas').length) {
@@ -4926,7 +4927,7 @@ var svgEditorExtension_server_moinsave = (function () {
method: 'post',
action: saveSvgAction + '/' + name,
target: 'output_frame'
}).append('<input type="hidden" name="png_data" value="' + pngData + '">').append('<input type="hidden" name="filepath" value="' + svgData + '">').append('<input type="hidden" name="filename" value="' + 'drawing.svg">').append('<input type="hidden" name="contenttype" value="application/x-svgdraw">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"png_data\" value=\"".concat(pngData, "\">\n <input type=\"hidden\" name=\"filepath\" value=\"").concat(svgData, "\">\n <input type=\"hidden\" name=\"filename\" value=\"drawing.svg\">\n <input type=\"hidden\" name=\"contenttype\" value=\"application/x-svgdraw\">\n ")).appendTo('body').submit().remove();
$.alert(strings.saved);
top.window.location = '/' + name;

View File

@@ -4868,7 +4868,7 @@ var svgEditorExtension_server_opensave = (function () {
var _init = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee5(_ref) {
var $, decode64, encode64, importLocale, strings, svgEditor, svgCanvas, getFileNameFromTitle, xhtmlEscape, clientDownloadSupport, saveSvgAction, saveImgAction, cancelled, openSvgAction, importSvgAction, importImgAction, openSvgForm, importSvgForm, importImgForm, rebuildInput;
var $, decode64, encode64, importLocale, strings, svgEditor, extPath, svgCanvas, getFileNameFromTitle, xhtmlEscape, clientDownloadSupport, saveSvgAction, saveImgAction, cancelled, openSvgAction, importSvgAction, importImgAction, openSvgForm, importSvgForm, importImgForm, rebuildInput;
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
@@ -5006,18 +5006,18 @@ var svgEditorExtension_server_opensave = (function () {
case 7:
strings = _context5.sent;
svgEditor = this;
svgCanvas = svgEditor.canvas;
extPath = svgEditor.curConfig, svgCanvas = svgEditor.canvas;
/**
*
* @returns {string}
*/
saveSvgAction = svgEditor.curConfig.extPath + 'filesave.php', saveImgAction = svgEditor.curConfig.extPath + 'filesave.php'; // Create upload target (hidden iframe)
saveSvgAction = extPath + 'filesave.php', saveImgAction = extPath + 'filesave.php'; // Create upload target (hidden iframe)
cancelled = false; // Hiding by size instead of display to avoid FF console errors
// with `getBBox` in browser.js `supportsPathBBox_`)
$("<iframe name=\"output_frame\" title=\"".concat(strings.hiddenframe, "\"\n style=\"width: 0; height: 0;\" src=\"#\"/>")).appendTo('body');
$("<iframe name=\"output_frame\" title=\"".concat(strings.hiddenframe, "\"\n style=\"width: 0; height: 0;\" src=\"#\"/>")).appendTo('body');
svgEditor.setCustomHandlers({
save: function save(win, data) {
var svg = '<?xml version="1.0" encoding="UTF-8"?>\n' + data,
@@ -5032,7 +5032,7 @@ var svgEditorExtension_server_opensave = (function () {
method: 'post',
action: saveSvgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_svg" value="' + xhtmlEscape(svg) + '">').append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"output_svg\" value=\"".concat(xhtmlEscape(svg), "\">\n <input type=\"hidden\" name=\"filename\" value=\"").concat(xhtmlEscape(filename), "\">\n ")).appendTo('body').submit().remove();
},
exportPDF: function exportPDF(win, data) {
var filename = getFileNameFromTitle(),
@@ -5046,7 +5046,7 @@ var svgEditorExtension_server_opensave = (function () {
method: 'post',
action: saveImgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">').append('<input type="hidden" name="mime" value="application/pdf">').append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"output_img\" value=\"".concat(datauri, "\">\n <input type=\"hidden\" name=\"mime\" value=\"application/pdf\">\n <input type=\"hidden\" name=\"filename\" value=\"").concat(xhtmlEscape(filename), "\">\n ")).appendTo('body').submit().remove();
},
// Todo: Integrate this extension with a new built-in exportWindowType, "download"
exportImage: function () {
@@ -5079,7 +5079,8 @@ var svgEditorExtension_server_opensave = (function () {
note = '';
if (issues.length) {
pre = "\n \u2022 ";
pre = "\n \u2022 "; // Bullet
note += '\n\n' + pre + issues.join(pre);
}
@@ -5107,7 +5108,7 @@ var svgEditorExtension_server_opensave = (function () {
method: 'post',
action: saveImgAction,
target: 'output_frame'
}).append('<input type="hidden" name="output_img" value="' + datauri + '">').append('<input type="hidden" name="mime" value="' + mimeType + '">').append('<input type="hidden" name="filename" value="' + xhtmlEscape(filename) + '">').appendTo('body').submit().remove();
}).append("\n <input type=\"hidden\" name=\"output_img\" value=\"".concat(datauri, "\">\n <input type=\"hidden\" name=\"mime\" value=\"").concat(mimeType, "\">\n <input type=\"hidden\" name=\"filename\" value=\"").concat(xhtmlEscape(filename), "\">\n ")).appendTo('body').submit().remove();
case 18:
case "end":
@@ -5134,9 +5135,9 @@ var svgEditorExtension_server_opensave = (function () {
case 16:
// Change these to appropriate script file
openSvgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=load_svg';
importSvgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=import_svg';
importImgAction = svgEditor.curConfig.extPath + 'fileopen.php?type=import_img'; // Set up function for PHP uploader to use
openSvgAction = extPath + 'fileopen.php?type=load_svg';
importSvgAction = extPath + 'fileopen.php?type=import_svg';
importImgAction = extPath + 'fileopen.php?type=import_img'; // Set up function for PHP uploader to use
svgEditor.processFile = function (str64, type) {
var xmlstr;