fix markdown widget re-rendering on load
This commit is contained in:
@ -44,17 +44,7 @@ export default class Editor extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
return (this.props.value !== null && nextProps.value === null)
|
return !this.state.value.equals(nextState.value);
|
||||||
|| (this.props.value === null && nextProps.value !== null)
|
|
||||||
|| !this.state.value.equals(nextState.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUpdate(nextProps) {
|
|
||||||
const shouldResetState = (this.props.value !== null && nextProps.value === null)
|
|
||||||
|| (this.props.value === null && nextProps.value !== null)
|
|
||||||
if (shouldResetState) {
|
|
||||||
this.setState({ value: createSlateValue(nextProps.value) });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePaste = (e, data, change) => {
|
handlePaste = (e, data, change) => {
|
||||||
|
Reference in New Issue
Block a user