diff --git a/lib/components/content.js b/lib/components/content.js index 0566e16e2..a8046caa7 100644 --- a/lib/components/content.js +++ b/lib/components/content.js @@ -59,6 +59,33 @@ class Content extends React.Component { // ) } + /** + * While rendering set a flag, so that we can ignore any `select` events that + * fire because of the leaf nodes updating their selection. + * + * @param {Object} props + */ + + componentWillMount(props) { + this.tmp.isRendering = true + } + + componentWillUpdate(props) { + this.tmp.isRendering = true + } + + componentDidMount() { + setTimeout(() => { + this.tmp.isRendering = false + }) + } + + componentDidUpdate() { + setTimeout(() => { + this.tmp.isRendering = false + }) + } + /** * On before input, bubble up. * @@ -262,6 +289,7 @@ class Content extends React.Component { */ onSelect(e) { + if (this.tmp.isRendering) return if (this.tmp.isCopying) return let { state } = this.props