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) => {
|
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
|
// If the state has been transformed natively, never re-render, or else we
|
||||||
// will end up duplicating content.
|
// will end up duplicating content.
|
||||||
if (props.state.isNative) return false
|
if (props.state.isNative) return false
|
||||||
|
|
||||||
return (
|
return (
|
||||||
props.className != this.props.className ||
|
props.className != this.props.className ||
|
||||||
props.readOnly != this.props.readOnly ||
|
|
||||||
props.schema != this.props.schema ||
|
props.schema != this.props.schema ||
|
||||||
props.spellCheck != this.props.spellCheck ||
|
props.spellCheck != this.props.spellCheck ||
|
||||||
props.state != this.props.state ||
|
props.state != this.props.state ||
|
||||||
|
Reference in New Issue
Block a user