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:
@@ -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
|
||||
|
Reference in New Issue
Block a user