mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
Fix bug with non-immediate updating of readOnly state (#292)
* Fix bug with non-immediate updating of readOnly state * Added comment for readOnly checking
This commit is contained in:
committed by
Ian Storm Taylor
parent
91cc23bbdb
commit
d16e08214e
@@ -93,13 +93,16 @@ class Content extends React.Component {
|
||||
*/
|
||||
|
||||
shouldComponentUpdate = (props, state) => {
|
||||
// If the readOnly state has changed, we need to re-render so that
|
||||
// the cursor will be added or removed again.
|
||||
if (props.readOnly != this.props.readOnly) return true
|
||||
|
||||
// If the state has been transformed natively, never re-render, or else we
|
||||
// will end up duplicating content.
|
||||
if (props.state.isNative) return false
|
||||
|
||||
return (
|
||||
props.className != this.props.className ||
|
||||
props.readOnly != this.props.readOnly ||
|
||||
props.schema != this.props.schema ||
|
||||
props.spellCheck != this.props.spellCheck ||
|
||||
props.state != this.props.state ||
|
||||
|
Reference in New Issue
Block a user