mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
refs #246 Fix a Bug when using the Finder Window with markdown Notes
This commit is contained in:
@@ -48,34 +48,21 @@ class FinderMain extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.focusHandler = (e) => this.handleWindowFocus(e)
|
this.focusHandler = (e) => this.handleWindowFocus(e)
|
||||||
this.blurHandler = (e) => this.handleWindowBlur(e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.refs.search.focus()
|
this.refs.search.focus()
|
||||||
window.addEventListener('focus', this.focusHandler)
|
window.addEventListener('focus', this.focusHandler)
|
||||||
window.addEventListener('blur', this.blurHandler)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
window.removeEventListener('focus', this.focusHandler)
|
window.removeEventListener('focus', this.focusHandler)
|
||||||
window.removeEventListener('blur', this.blurHandler)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleWindowFocus (e) {
|
handleWindowFocus (e) {
|
||||||
this.refs.search.focus()
|
this.refs.search.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleWindowBlur (e) {
|
|
||||||
let { filter } = this.state
|
|
||||||
filter.type = 'ALL'
|
|
||||||
this.setState({
|
|
||||||
search: '',
|
|
||||||
filter,
|
|
||||||
index: 0
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
handleKeyDown (e) {
|
handleKeyDown (e) {
|
||||||
this.refs.search.focus()
|
this.refs.search.focus()
|
||||||
if (e.keyCode === 9) {
|
if (e.keyCode === 9) {
|
||||||
|
|||||||
Reference in New Issue
Block a user