1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 04:20:26 +02:00

fix double selecting

This commit is contained in:
Ian Storm Taylor
2016-06-30 18:58:07 -07:00
parent a8f26df61b
commit 1c8986019d

View File

@@ -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