1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-05-27 17:53: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
+9 -5
View File
@@ -85,11 +85,15 @@ class MarkdownNoteDetail extends React.Component {
// Focus content if using blur or double click // 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 // --> Moved here from componentDidMount so a re-render during search won't set focus to the editor
const {switchPreview} = nextProps.config.editor const {switchPreview} = nextProps.config.editor
this.setState({
switchPreview if (this.state.switchPreview !== switchPreview) {
}) this.setState({
if (switchPreview === 'BLUR' || switchPreview === 'DBL_CLICK') { switchPreview
this.focus() })
if (switchPreview === 'BLUR' || switchPreview === 'DBL_CLICK') {
console.log('setting focus', switchPreview)
this.focus()
}
} }
} }