mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix focusing bug
This commit is contained in:
@@ -15,11 +15,12 @@ const { remote } = electron
|
|||||||
const { Menu } = remote
|
const { Menu } = remote
|
||||||
|
|
||||||
function hideFinder () {
|
function hideFinder () {
|
||||||
if (process.platform === 'win32') {
|
let finderWindow = remote.getCurrentWindow()
|
||||||
remote.getCurrentWindow().minimize()
|
if (global.process.platform === 'win32') {
|
||||||
return
|
finderWindow.blur()
|
||||||
|
finderWindow.hide()
|
||||||
}
|
}
|
||||||
if (process.platform === 'darwin') {
|
if (global.process.platform === 'darwin') {
|
||||||
Menu.sendActionToFirstResponder('hide:')
|
Menu.sendActionToFirstResponder('hide:')
|
||||||
}
|
}
|
||||||
remote.getCurrentWindow().hide()
|
remote.getCurrentWindow().hide()
|
||||||
@@ -48,6 +49,7 @@ class FinderMain extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
|
this.refs.search.focus()
|
||||||
window.addEventListener('focus', this.focusHandler)
|
window.addEventListener('focus', this.focusHandler)
|
||||||
window.addEventListener('blur', this.blurHandler)
|
window.addEventListener('blur', this.blurHandler)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,21 @@ function toggleFinder () {
|
|||||||
finderWindow.show()
|
finderWindow.show()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!finderWindow.isMinimized()) {
|
if (finderWindow.isVisible()) {
|
||||||
finderWindow.minimize()
|
finderWindow.blur()
|
||||||
|
finderWindow.hide()
|
||||||
} else {
|
} else {
|
||||||
nodeIpc.of.node.emit('request-data')
|
nodeIpc.of.node.emit('request-data')
|
||||||
finderWindow.restore()
|
finderWindow.show()
|
||||||
|
finderWindow.focus()
|
||||||
}
|
}
|
||||||
|
// if (!finderWindow.isMinimized()) {
|
||||||
|
// finderWindow.minimize()
|
||||||
|
// } else {
|
||||||
|
// nodeIpc.of.node.emit('request-data')
|
||||||
|
// finderWindow.restore()
|
||||||
|
// finderWindow.focus()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user