1
0
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:
Dick Choi
2016-06-12 19:55:39 +09:00
parent eb1a0ba49f
commit ce915df2b2
7 changed files with 65 additions and 7 deletions

View File

@@ -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) {