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

@@ -40,13 +40,20 @@ var LaunchModal = React.createClass({
this.setState({currentTab: 'blueprint'})
},
submit: function () {
// this.props.submit('yolo')
if (this.state.currentTab === 'snippet') {
console.log(this.state.snippet)
} else {
console.log(this.state.blueprint)
}
},
handleKeyDown: function (e) {
if (e.keyCode === 37 && e.metaKey) {
this.selectSnippetTab()
}
if (e.keyCode === 39 && e.metaKey) {
this.selectBlueprintTab()
}
},
render: function () {
var modalBody
if (this.state.currentTab === 'snippet') {
@@ -60,7 +67,7 @@ var LaunchModal = React.createClass({
}
return (
<div onClick={this.stopPropagation} className='LaunchModal modal'>
<div onKeyDown={this.handleKeyDown} onClick={this.stopPropagation} className='LaunchModal modal'>
<div className='modal-header'>
<div className='modal-tab'>
<button className={this.state.currentTab === 'snippet' ? 'btn-primary active' : 'btn-default'} onClick={this.selectSnippetTab}>Snippet</button><button className={this.state.currentTab === 'blueprint' ? 'btn-primary active' : 'btn-default'} onClick={this.selectBlueprintTab}>Blueprint</button>