Skip to content

Commit

Permalink
make Editor.js the entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhenon committed Aug 1, 2021
1 parent 3febd28 commit 8644836
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 147 deletions.
6 changes: 3 additions & 3 deletions rollup.config.js
Expand Up @@ -37,19 +37,19 @@ rimraf('./dist', () => console.info('recreating dist'));

// config for svgedit core module
const config = [ {
input: [ 'src/editor/index.js' ],
input: [ 'src/editor/Editor.js' ],
output: [
{
format: 'es',
inlineDynamicImports: true,
sourcemap: true,
file: 'dist/editor/index.js'
file: 'dist/editor/Editor.js'
},
{
format: 'es',
inlineDynamicImports: true,
sourcemap: true,
file: 'dist/editor/xdomain-index.js',
file: 'dist/editor/xdomain-Editor.js',
intro: 'const XDOMAIN = true;'
}
],
Expand Down
27 changes: 25 additions & 2 deletions src/editor/index.html
Expand Up @@ -22,13 +22,36 @@

<!-- If you do not wish to add extensions by URL, you can add calls
within the following file to svgEditor.setConfig -->
<script type="module" src="./index.js"></script>
<script type="module">
/* for available options see the file `docs/tutorials/ConfigOptions.md */
import Editor from './Editor.js';
const svgEditor = new Editor(document.getElementsByClassName('svg_editor')[0]);
svgEditor.init();
svgEditor.setConfig({
allowInitialUserOverride: true,
extensions: [],
noDefaultExtensions: false,
userExtensions: [/* '../ext-helloworld/ext-helloworld.js' */]
});

// 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 */ }
</script>

<title>SVG-edit</title>
</head>

<body>
<div id="svg_editor" role="main"></div>
<div class="svg_editor" role="main"></div>
</body>

</html>
142 changes: 0 additions & 142 deletions src/editor/index.js

This file was deleted.

0 comments on commit 8644836

Please sign in to comment.