1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

fix focus loss by checking switchPrieview prop change

This commit is contained in:
AWolf81
2019-05-29 07:52:22 +02:00
parent 25d055e560
commit 60e841e5a2

View File

@@ -85,11 +85,15 @@ class MarkdownNoteDetail extends React.Component {
// Focus content if using blur or double click
// --> Moved here from componentDidMount so a re-render during search won't set focus to the editor
const {switchPreview} = nextProps.config.editor
this.setState({
switchPreview
})
if (switchPreview === 'BLUR' || switchPreview === 'DBL_CLICK') {
this.focus()
if (this.state.switchPreview !== switchPreview) {
this.setState({
switchPreview
})
if (switchPreview === 'BLUR' || switchPreview === 'DBL_CLICK') {
console.log('setting focus', switchPreview)
this.focus()
}
}
}