mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-17 03:31:52 +00:00
fix focus loss by checking switchPrieview prop change
This commit is contained in:
@@ -85,13 +85,17 @@ 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
|
||||||
|
|
||||||
|
if (this.state.switchPreview !== switchPreview) {
|
||||||
this.setState({
|
this.setState({
|
||||||
switchPreview
|
switchPreview
|
||||||
})
|
})
|
||||||
if (switchPreview === 'BLUR' || switchPreview === 'DBL_CLICK') {
|
if (switchPreview === 'BLUR' || switchPreview === 'DBL_CLICK') {
|
||||||
|
console.log('setting focus', switchPreview)
|
||||||
this.focus()
|
this.focus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
ee.off('topbar:togglelockbutton', this.toggleLockButton)
|
ee.off('topbar:togglelockbutton', this.toggleLockButton)
|
||||||
|
|||||||
Reference in New Issue
Block a user