1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 18:56:22 +00:00

add hotkey

This commit is contained in:
Rokt33r
2015-07-19 03:19:41 +09:00
parent aa71251edd
commit 16b60ada50
5 changed files with 34 additions and 6 deletions

View File

@@ -17,8 +17,19 @@ var PlanetNavigator = React.createClass({
isLaunchModalOpen: false
}
},
handleKeyDown: function (e) {
if (e.keyCode === 13 && e.metaKey) {
e.preventDefault()
this.openLaunchModal()
}
},
componentDidMount: function () {
document.addEventListener('keydown', this.handleKeyDown, false)
},
componentWillUnmount: function () {
document.removeEventListener('keydown', this.handleKeyDown, false)
},
openLaunchModal: function () {
console.log('and...OPEN!!')
this.setState({isLaunchModalOpen: true})
},
closeLaunchModal: function () {