diff --git a/src/editor/widgets/WrappedWidget.jsx b/src/editor/widgets/WrappedWidget.jsx index 9b9ac4e..cc7737a 100644 --- a/src/editor/widgets/WrappedWidget.jsx +++ b/src/editor/widgets/WrappedWidget.jsx @@ -1,17 +1,18 @@ import React, { Component } from 'react'; export default class WrappedWidget extends Component { + constructor(props) { super(props); this.element = React.createRef(); } - updateWidget(props) { + renderWidget(props) { const widgetEl = this.props.widget({ annotation: props.annotation, readOnly: props.readOnly, - ...this.props.config, + ...props.config, onAppendBody: body => props.onAppendBody(body), onUpdateBody: (previous, updated) => props.onUpdateBody(previous, updated), onRemoveBody: body => props.onRemoveBody(body), @@ -26,13 +27,13 @@ export default class WrappedWidget extends Component { } componentDidMount() { - this.updateWidget(this.props); + this.renderWidget(this.props); } componentWillReceiveProps(next) { if (this.element.current) { if (this.props.annotation !== next.annotation) { - this.updateWidget(next); + this.renderWidget(next); } } }