mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +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"
|
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) => {
|
handlePageTransition = (key) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
transitionActive: true,
|
transitionActive: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user