diff --git a/src/components/paint-editor/paint-editor.jsx b/src/components/paint-editor/paint-editor.jsx index d8669059..9449f1f4 100644 --- a/src/components/paint-editor/paint-editor.jsx +++ b/src/components/paint-editor/paint-editor.jsx @@ -169,6 +169,7 @@ class PaintEditorComponent extends React.Component { rotationCenterX={this.props.rotationCenterX} rotationCenterY={this.props.rotationCenterY} svg={this.props.svg} + svgId={this.props.svgId} /> @@ -186,7 +187,8 @@ PaintEditorComponent.propTypes = { onUpdateSvg: PropTypes.func.isRequired, rotationCenterX: PropTypes.number, rotationCenterY: PropTypes.number, - svg: PropTypes.string + svg: PropTypes.string, + svgId: PropTypes.string }; export default injectIntl(PaintEditorComponent); diff --git a/src/containers/paint-editor.jsx b/src/containers/paint-editor.jsx index 49ce6c8f..f8f2753c 100644 --- a/src/containers/paint-editor.jsx +++ b/src/containers/paint-editor.jsx @@ -58,6 +58,7 @@ class PaintEditor extends React.Component { rotationCenterX={this.props.rotationCenterX} rotationCenterY={this.props.rotationCenterY} svg={this.props.svg} + svgId={this.props.svgId} onRedo={this.handleRedo} onUndo={this.handleUndo} onUpdateName={this.props.onUpdateName} @@ -77,6 +78,7 @@ PaintEditor.propTypes = { rotationCenterX: PropTypes.number, rotationCenterY: PropTypes.number, svg: PropTypes.string, + svgId: PropTypes.string, undoSnapshot: PropTypes.func.isRequired, undoState: PropTypes.shape({ stack: PropTypes.arrayOf(PropTypes.object).isRequired, diff --git a/src/containers/paper-canvas.jsx b/src/containers/paper-canvas.jsx index aa450598..beb0d8d7 100644 --- a/src/containers/paper-canvas.jsx +++ b/src/containers/paper-canvas.jsx @@ -29,6 +29,7 @@ class PaperCanvas extends React.Component { } } componentWillReceiveProps (newProps) { + if (this.props.svgId === newProps.svgId) return; for (const layer of paper.project.layers) { layer.removeChildren(); } @@ -108,6 +109,7 @@ PaperCanvas.propTypes = { rotationCenterX: PropTypes.number, rotationCenterY: PropTypes.number, svg: PropTypes.string, + svgId: PropTypes.string, undoSnapshot: PropTypes.func.isRequired }; const mapDispatchToProps = dispatch => ({ diff --git a/src/playground/playground.jsx b/src/playground/playground.jsx index e69efd26..881b7940 100644 --- a/src/playground/playground.jsx +++ b/src/playground/playground.jsx @@ -49,6 +49,7 @@ class Playground extends React.Component { return (