I tried to integrate svgcanvas in a angular project to create our own SVG-Editor GUI with the gread editor from svgedit. I installed the plugin with npm and tried to instantiate a new Canvas inside a angular component:
import SvgCanvas from '@svgedit/svgcanvas';
const container = document.querySelector('#editorContainer');
const config = {
initFill: { color: 'FFFFFF', opacity: 1 },
initStroke: { color: '000000', opacity: 1, width: 1 },
text: { stroke_width: 0, font_size: 24, font_family: 'serif' },
initOpacity: 1,
imgPath: '/src/editor/images',
dimensions: [ 500, 300 ],
baseUnit: 'px'
}
this.canvas = new SvgCanvas(container, config);
But i'm not able to use it. I get the error:
ERROR in ./node_modules/@svgedit/svgcanvas/dist/svgcanvas.js 8:4068 Module parse failed: Unexpected token (8:4068) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)
It seems that this is a Problem with Typescript that does not understand how to mange the js-File. I never had such a problem with a npm-imported dependency and cant find any solution for that. Maybe someone can help?
Regards Michael