mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-30 10:01:54 +00:00
cleanup
This commit is contained in:
@@ -13,16 +13,21 @@ class Detail extends React.Component {
|
||||
super(props)
|
||||
|
||||
this.focusHandler = () => {
|
||||
this.refs.root.focus()
|
||||
this.refs.root != null && this.refs.root.focus()
|
||||
}
|
||||
this.deleteHandler = () => {
|
||||
this.refs.root != null && this.refs.root.handleDeleteMenuClick()
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
ee.on('detail:focus', this.focusHandler)
|
||||
ee.on('detail:delete', this.deleteHandler)
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
ee.off('detail:focus', this.focusHandler)
|
||||
ee.off('detail:delete', this.deleteHandler)
|
||||
}
|
||||
|
||||
render () {
|
||||
@@ -46,7 +51,6 @@ class Detail extends React.Component {
|
||||
<div styleName='root'
|
||||
style={this.props.style}
|
||||
tabIndex='0'
|
||||
ref='root'
|
||||
>
|
||||
<div styleName='empty'>
|
||||
<div styleName='empty-message'>{OSX ? 'Command(⌘)' : 'Ctrl(^)'} + N<br/>to create a new post</div>
|
||||
|
||||
@@ -5,6 +5,7 @@ import _ from 'lodash'
|
||||
import modal from 'browser/main/lib/modal'
|
||||
import NewNoteModal from 'browser/main/modals/NewNoteModal'
|
||||
import { hashHistory } from 'react-router'
|
||||
import ee from 'browser/main/lib/eventEmitter'
|
||||
|
||||
const OSX = window.process.platform === 'darwin'
|
||||
|
||||
@@ -17,6 +18,18 @@ class TopBar extends React.Component {
|
||||
searchOptions: [],
|
||||
searchPopupOpen: false
|
||||
}
|
||||
|
||||
this.newNoteHandler = () => {
|
||||
this.handleNewPostButtonClick()
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
ee.on('top:new-note', this.newNoteHandler)
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
ee.off('top:new-note', this.newNoteHandler)
|
||||
}
|
||||
|
||||
handleNewPostButtonClick (e) {
|
||||
|
||||
Reference in New Issue
Block a user