migration to vite/playwright
This commit is contained in:
@@ -672,8 +672,8 @@ class EditorStartup {
|
||||
/**
|
||||
* @type {module:SVGthis.ExtensionObject}
|
||||
*/
|
||||
const extPath = this.configObj.curConfig.extPath
|
||||
const imported = await import(`${extPath}/${encodeURIComponent(extname)}/${encodeURIComponent(extname)}.js`)
|
||||
// Vite cannot statically analyze these dynamic extension imports.
|
||||
const imported = await import(/* @vite-ignore */ `${this.configObj.curConfig.extPath}/${encodeURIComponent(extname)}/${encodeURIComponent(extname)}.js`)
|
||||
const { name = extname, init: initfn } = imported.default
|
||||
return this.addExtension(name, (initfn && initfn.bind(this)), { langParam: 'en' }) /** @todo change to current lng */
|
||||
} catch (err) {
|
||||
@@ -696,7 +696,7 @@ class EditorStartup {
|
||||
/**
|
||||
* @type {module:SVGthis.ExtensionObject}
|
||||
*/
|
||||
const imported = await import(encodeURI(pathName))
|
||||
const imported = await import(/* @vite-ignore */ encodeURI(pathName))
|
||||
const { name, init: initfn } = imported.default
|
||||
return this.addExtension(name, (initfn && initfn.bind(this, config)), {})
|
||||
} catch (err) {
|
||||
|
||||
@@ -166,7 +166,6 @@
|
||||
<legend id="svginfo_editor_prefs"></legend>
|
||||
<label>
|
||||
<span id="svginfo_lang"></span>
|
||||
<!-- Source: https://en.wikipedia.org/wiki/Language_names -->
|
||||
<select id="lang_select">
|
||||
<option id="lang_ar" value="ar">العربية</option>
|
||||
<option id="lang_cs" value="cs">Čeština</option>
|
||||
|
||||
32
src/editor/iife-index.html
Normal file
32
src/editor/iife-index.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<link rel="icon" href="images/logo.svg">
|
||||
<style id="styleoverrides" media="screen"></style>
|
||||
<link href="./svgedit.css" rel="stylesheet" media="all">
|
||||
<script type="module" src="./browser-not-supported.js"></script>
|
||||
<title>SVG-edit (IIFE)</title>
|
||||
</head>
|
||||
|
||||
<body style="margin:0">
|
||||
<div id="container" style="width:100%;height:100vh"></div>
|
||||
</body>
|
||||
<script src="./iife-Editor.js"></script>
|
||||
<script>
|
||||
const EditorCtor = (window.Editor && window.Editor.default) || window.Editor
|
||||
const svgEditor = new EditorCtor(document.getElementById('container'))
|
||||
svgEditor.setConfig({
|
||||
allowInitialUserOverride: true,
|
||||
extensions: [],
|
||||
noDefaultExtensions: false,
|
||||
userExtensions: []
|
||||
})
|
||||
svgEditor.init()
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -11,7 +11,6 @@
|
||||
<!-- STYLESHEETS (others loaded dynamically) -->
|
||||
<style id="styleoverrides" media="screen"></style>
|
||||
<link href="./svgedit.css" rel="stylesheet" media="all">
|
||||
</link>
|
||||
<!-- Lacking browser support -->
|
||||
<script type="module" src="./browser-not-supported.js"></script>
|
||||
<title>SVG-edit</title>
|
||||
@@ -40,17 +39,13 @@
|
||||
userExtensions: [/* { pathName: '/packages/react-test/dist/react-test.js' } */]
|
||||
})
|
||||
svgEditor.init()
|
||||
// Variable XDOMAIN below is created by Rollup for the Xdomain build (see rollup.config.js)
|
||||
/* globals XDOMAIN */
|
||||
try { // try clause to avoid js to complain if XDOMAIN undefined
|
||||
if (XDOMAIN) {
|
||||
svgEditor.setConfig({
|
||||
canvasName: 'xdomain', // Namespace this
|
||||
allowedOrigins: ['*']
|
||||
})
|
||||
console.info('xdomain config activated')
|
||||
}
|
||||
} catch (error) { /* empty fn */ }
|
||||
if (typeof XDOMAIN !== 'undefined' && XDOMAIN) {
|
||||
svgEditor.setConfig({
|
||||
canvasName: 'xdomain', // Namespace this
|
||||
allowedOrigins: ['*']
|
||||
})
|
||||
console.info('xdomain config activated')
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
39
src/editor/xdomain-index.html
Normal file
39
src/editor/xdomain-index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<link rel="icon" href="images/logo.svg">
|
||||
<style id="styleoverrides" media="screen"></style>
|
||||
<link href="./svgedit.css" rel="stylesheet" media="all">
|
||||
<script type="module" src="./browser-not-supported.js"></script>
|
||||
<title>SVG-edit (xdomain)</title>
|
||||
</head>
|
||||
|
||||
<body style="margin:0">
|
||||
<div id="container" style="width:100%;height:100vh"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import Editor from './Editor.js'
|
||||
const XDOMAIN = true
|
||||
const svgEditor = new Editor(document.getElementById('container'))
|
||||
svgEditor.setConfig({
|
||||
allowInitialUserOverride: true,
|
||||
extensions: [],
|
||||
noDefaultExtensions: false,
|
||||
userExtensions: []
|
||||
})
|
||||
svgEditor.init()
|
||||
if (typeof XDOMAIN !== 'undefined' && XDOMAIN) {
|
||||
svgEditor.setConfig({
|
||||
canvasName: 'xdomain',
|
||||
allowedOrigins: ['*']
|
||||
})
|
||||
console.info('xdomain config activated')
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user