mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-02-07 23:38:41 +01:00
exit settings with escape key
This commit is contained in:
parent
837335bfda
commit
478a12c036
@ -23,10 +23,19 @@ class Settings extends React.Component<SettingsProps> {
|
||||
super(props)
|
||||
}
|
||||
|
||||
onKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape" && !this.props.exitting) this.props.close()
|
||||
}
|
||||
|
||||
componentDidUpdate = (prevProps: SettingsProps) => {
|
||||
if (window.utils.platform === "darwin" && this.props.display !== prevProps.display) {
|
||||
if (this.props.display) window.utils.destroyTouchBar()
|
||||
else initTouchBarWithTexts()
|
||||
if (this.props.display !== prevProps.display) {
|
||||
if (this.props.display) {
|
||||
if (window.utils.platform === "darwin") window.utils.destroyTouchBar()
|
||||
document.body.addEventListener("keydown", this.onKeyDown)
|
||||
} else {
|
||||
if (window.utils.platform === "darwin") initTouchBarWithTexts()
|
||||
document.body.removeEventListener("keydown", this.onKeyDown)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user