use a fixed import for canvg

This commit is contained in:
jfh
2020-08-29 00:02:35 +02:00
parent 44f9190403
commit e22ea424db
596 changed files with 24 additions and 341398 deletions

View File

@@ -159,7 +159,6 @@ const callbacks = [],
* @property {string} [imgPath="images/"] The path where the SVG icons are located, with trailing slash. Note that as of version 2.7, this is not configurable by URL for security reasons.
* @property {string} [langPath="locale/"] The path where the language files are located, with trailing slash. Default will be changed to `../dist/locale/` if this is a modular load. Note that as of version 2.7, this is not configurable by URL for security reasons.
* @property {string} [extPath="extensions/"] The path used for extension files, with trailing slash. Default will be changed to `../dist/extensions/` if this is a modular load. Note that as of version 2.7, this is not configurable by URL for security reasons.
* @property {string} [canvgPath="canvg/"] The path used for `canvg` files, with trailing slash. Default will be changed to `../dist/` if this is a modular load.
* @property {string} [extIconsPath="extensions/"] The path used for extension icons, with trailing slash.
* @property {string} [jGraduatePath="jgraduate/images/"] The path where jGraduate images are located. Note that as of version 2.7, this is not configurable by URL for security reasons.
* @property {boolean} [preventAllURLConfig=false] Set to `true` to override the ability for URLs to set non-content configuration (including extension config). Must be set early, i.e., in `svgedit-config-iife.js`; extension loading is too late!
@@ -237,7 +236,6 @@ const callbacks = [],
// The following path configuration items are disallowed in the URL (as should any future path configurations)
langPath: './locale/', // Default will be changed if this is a non-modular load
extPath: './extensions/', // Default will be changed if this is a non-modular load
canvgPath: './canvg/', // Default will be changed if this is a non-modular load
imgPath: './images/',
jGraduatePath: './images/',
extIconsPath: './extensions/',
@@ -736,14 +734,12 @@ editor.init = function () {
// security reasons, even for same-domain
// ones given potential to interact in undesirable
// ways with other script resources
[
'langPath', 'extPath', 'canvgPath',
'imgPath', 'jGraduatePath', 'extIconsPath'
].forEach(function (pathConfig) {
if (urldata[pathConfig]) {
delete urldata[pathConfig];
}
});
['langPath', 'extPath', 'imgPath', 'jGraduatePath', 'extIconsPath']
.forEach(function (pathConfig) {
if (urldata[pathConfig]) {
delete urldata[pathConfig];
}
});
// Note: `source` and `url` (as with `storagePrompt` later) are not
// set on config but are used below

View File

@@ -17,6 +17,8 @@
import {jsPDF} from 'jspdf';
import 'svg2pdf.js/dist/svg2pdf.es.js';
import {canvg} from '../external/canvg/canvg.js';
import '../common/svgpathseg.js';
import jQueryPluginSVG from '../common/jQuery.attr.js'; // Needed for SVG attribute setting and array form with `attr`
import jQueryPluginDBox from './dbox.js';
@@ -3952,10 +3954,9 @@ function hideCursor () {
return {issues, issueCodes};
}
let canvg;
/**
* @typedef {"feGaussianBlur"|"foreignObject"|"[stroke-dasharray]"|"text"} module:svgcanvas.IssueCode
*/
* @typedef {"feGaussianBlur"|"foreignObject"|"[stroke-dasharray]"|"text"} module:svgcanvas.IssueCode
*/
/**
* @typedef {PlainObject} module:svgcanvas.ImageExportedResults
* @property {string} datauri Contents as a Data URL
@@ -3989,10 +3990,6 @@ function hideCursor () {
const {issues, issueCodes} = getIssues();
const svg = this.svgCanvasToString();
if (!canvg) {
// eslint-disable-next-line node/no-unsupported-features/es-syntax
({canvg} = await import(curConfig.canvgPath + 'canvg.js').default);
}
if (!$('#export_canvas').length) {
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
}