Bugfix
This commit is contained in:
parent
1cde3d866d
commit
31a2d13cdb
|
@ -7,18 +7,24 @@ export default class DOMWidget extends Component {
|
||||||
this.element = React.createRef();
|
this.element = React.createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentWillReceiveProps(next) {
|
||||||
if (this.element.current) {
|
if (this.element.current) {
|
||||||
const widgetEl = this.props.widget({
|
if (this.props.annotation !== next.annotation) {
|
||||||
annotation: this.props.annotation,
|
const widgetEl = this.props.widget({
|
||||||
readOnly: this.props.readOnly,
|
annotation: this.props.annotation,
|
||||||
onAppendBody: body => this.props.onAppendBody(body),
|
readOnly: this.props.readOnly,
|
||||||
onUpdateBody: (previous, updated) => this.props.onUpdateBody(previous, updated),
|
onAppendBody: body => this.props.onAppendBody(body),
|
||||||
onRemoveBody: body => this.props.onRemoveBody(body),
|
onUpdateBody: (previous, updated) => this.props.onUpdateBody(previous, updated),
|
||||||
onSaveAndClose: () => this.props.onSaveAndClose()
|
onRemoveBody: body => this.props.onRemoveBody(body),
|
||||||
});
|
onSaveAndClose: () => this.props.onSaveAndClose()
|
||||||
|
});
|
||||||
|
|
||||||
this.element.current.appendChild(widgetEl);
|
// Delete previous rendered state
|
||||||
|
while (this.element.current.firstChild)
|
||||||
|
this.element.current.removeChild(this.element.current.lastChild);
|
||||||
|
|
||||||
|
this.element.current.appendChild(widgetEl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue