Minor renaming

This commit is contained in:
Rainer Simon 2021-07-10 09:24:54 +02:00
parent b29bb21d34
commit 724fc68e00
1 changed files with 5 additions and 4 deletions

View File

@ -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);
}
}
}