From 661a53e809c044e1b75be1f0db1bf5982f7e9d8f Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Thu, 7 Jan 2021 18:00:50 -0500 Subject: [PATCH] Use fixupSVGString from scratch-svg-renderer --- src/containers/paint-editor.jsx | 2 ++ src/containers/paper-canvas.jsx | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/containers/paint-editor.jsx b/src/containers/paint-editor.jsx index cd3d944ce5..202a36fc30 100644 --- a/src/containers/paint-editor.jsx +++ b/src/containers/paint-editor.jsx @@ -310,6 +310,7 @@ class PaintEditor extends React.Component { canUndo={this.props.shouldShowUndo} canvas={this.state.canvas} colorInfo={this.state.colorInfo} + fixupSvgStringFn={this.props.fixupSvgStringFn} format={this.props.format} image={this.props.image} imageFormat={this.props.imageFormat} @@ -341,6 +342,7 @@ PaintEditor.propTypes = { changeColorToEyeDropper: PropTypes.func, changeMode: PropTypes.func.isRequired, clearSelectedItems: PropTypes.func.isRequired, + fixupSvgStringFn: PropTypes.func, format: PropTypes.oneOf(Object.keys(Formats)), // Internal, up-to-date data format fontInlineFn: PropTypes.func, handleSwitchToBitmap: PropTypes.func.isRequired, diff --git a/src/containers/paper-canvas.jsx b/src/containers/paper-canvas.jsx index b28b40b98b..bd5226c228 100644 --- a/src/containers/paper-canvas.jsx +++ b/src/containers/paper-canvas.jsx @@ -195,16 +195,11 @@ class PaperCanvas extends React.Component { } importSvg (svg, rotationCenterX, rotationCenterY) { const paperCanvas = this; - // Pre-process SVG to prevent parsing errors (discussion from #213) - // 1. Remove svg: namespace on elements. - // TODO: remove - svg = svg.split(/<\s*svg:/).join('<'); - svg = svg.split(/<\/\s*svg:/).join(']*>/); - if (svgAttrs && svgAttrs[0].indexOf('xmlns=') === -1) { - svg = svg.replace( - '