diff --git a/lib/components/content.js b/lib/components/content.js index 34592e476..ff1662942 100644 --- a/lib/components/content.js +++ b/lib/components/content.js @@ -64,6 +64,22 @@ class Content extends React.Component { this.props.onBeforeInput(e) } + /** + * On blur, update the selection to be not focused. + * + * @param {Event} e + */ + + onBlur(e) { + if (this.tmp.isCopying) return + + let { state } = this.props + let { document, selection } = state + selection = selection.merge({ isFocused: false }) + state = state.merge({ selection }) + this.onChange(state) + } + /** * On change, bubble up. * @@ -296,6 +312,7 @@ class Content extends React.Component { contentEditable suppressContentEditableWarning style={style} onBeforeInput={e => this.onBeforeInput(e)} + onBlur={e => this.onBlur(e)} onCopy={e => this.onCopy(e)} onCut={e => this.onCut(e)} onKeyDown={e => this.onKeyDown(e)}