eliminate unnecessary editor renders

This commit is contained in:
Shawn Erquhart 2017-07-27 08:46:53 -04:00
parent de1e36108d
commit 28ee67c35e
2 changed files with 14 additions and 0 deletions

View File

@ -14,6 +14,13 @@ export default class RawEditor extends React.Component {
};
}
shouldComponentUpdate(nextProps, nextState) {
if (this.state.editorState.equals(nextState.editorState)) {
return false
}
return true;
}
handleChange = editorState => {
this.setState({ editorState });
}

View File

@ -255,6 +255,13 @@ export default class Editor extends Component {
};
}
shouldComponentUpdate(nextProps, nextState) {
if (this.state.editorState.equals(nextState.editorState)) {
return false
}
return true;
}
handlePaste = (e, data, state) => {
if (data.type !== 'html' || data.isShift) {
return;