mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
added esc
keybind
This commit is contained in:
parent
61452bfb7d
commit
28c655882c
@ -247,6 +247,25 @@ export default class SettingsMenu extends React.PureComponent {
|
||||
activeKey: "app"
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (typeof this.props.close === "function") {
|
||||
// register escape key to close settings menu
|
||||
window.addEventListener("keydown", this.handleKeyDown)
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (typeof this.props.close === "function") {
|
||||
window.removeEventListener("keydown", this.handleKeyDown)
|
||||
}
|
||||
}
|
||||
|
||||
handleKeyDown = (event) => {
|
||||
if (event.key === "Escape") {
|
||||
this.props.close()
|
||||
}
|
||||
}
|
||||
|
||||
handlePageTransition = (key) => {
|
||||
this.setState({
|
||||
transitionActive: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user