From d16e08214e7d12a162c18decfaed92e79730cef3 Mon Sep 17 00:00:00 2001 From: eden lane Date: Tue, 6 Sep 2016 02:07:05 +0300 Subject: [PATCH] Fix bug with non-immediate updating of readOnly state (#292) * Fix bug with non-immediate updating of readOnly state * Added comment for readOnly checking --- lib/components/content.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/components/content.js b/lib/components/content.js index f24caf6da..eb7b38ba8 100644 --- a/lib/components/content.js +++ b/lib/components/content.js @@ -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 ||