mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 10:46:32 +00:00
focus content editor after create new Note
This commit is contained in:
@@ -7,6 +7,7 @@ import StarButton from './StarButton'
|
||||
import TagSelect from './TagSelect'
|
||||
import FolderSelect from './FolderSelect'
|
||||
import Repository from 'browser/lib/Repository'
|
||||
import Commander from 'browser/main/lib/Commander'
|
||||
|
||||
class NoteDetail extends React.Component {
|
||||
constructor (props) {
|
||||
@@ -19,6 +20,21 @@ class NoteDetail extends React.Component {
|
||||
this.dispatchTimer = null
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
Commander.bind('note-detail', this)
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
Commander.release(this)
|
||||
}
|
||||
|
||||
fire (command) {
|
||||
switch (command) {
|
||||
case 'focus':
|
||||
this.refs.content.focus()
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps (nextProps) {
|
||||
if (nextProps.note.key !== this.props.note.key) {
|
||||
if (this.state.isDispatchQueued) {
|
||||
|
||||
Reference in New Issue
Block a user