diff --git a/browser/main/modals/NewNoteModal.js b/browser/main/modals/NewNoteModal.js index 185004e7..b748587c 100644 --- a/browser/main/modals/NewNoteModal.js +++ b/browser/main/modals/NewNoteModal.js @@ -12,8 +12,7 @@ class NewNoteModal extends React.Component { constructor (props) { super(props) - this.state = { - } + this.state = {} } componentDidMount () { @@ -35,19 +34,20 @@ class NewNoteModal extends React.Component { title: '', content: '' }) - .then((note) => { + .then(note => { const noteHash = note.key dispatch({ type: 'UPDATE_NOTE', note: note }) + hashHistory.push({ pathname: location.pathname, - query: {key: noteHash} + query: { key: noteHash } }) ee.emit('list:jump', noteHash) ee.emit('detail:focus') - this.props.close() + setTimeout(this.props.close, 200) }) } @@ -69,13 +69,15 @@ class NewNoteModal extends React.Component { folder: folder, title: '', description: '', - snippets: [{ - name: '', - mode: 'text', - content: '' - }] + snippets: [ + { + name: '', + mode: 'text', + content: '' + } + ] }) - .then((note) => { + .then(note => { const noteHash = note.key dispatch({ type: 'UPDATE_NOTE', @@ -83,11 +85,11 @@ class NewNoteModal extends React.Component { }) hashHistory.push({ pathname: location.pathname, - query: {key: noteHash} + query: { key: noteHash } }) ee.emit('list:jump', noteHash) ee.emit('detail:focus') - this.props.close() + setTimeout(this.props.close, 200) }) } @@ -106,49 +108,65 @@ class NewNoteModal extends React.Component { render () { return ( -
this.handleKeyDown(e)} + onKeyDown={e => this.handleKeyDown(e)} >
{i18n.__('Make a note')}
- this.handleCloseButtonClick(e)} /> + this.handleCloseButtonClick(e)} + />
- -
-
{i18n.__('Tab to switch format')}
+
+ {i18n.__('Tab to switch format')} +
) } } -NewNoteModal.propTypes = { -} +NewNoteModal.propTypes = {} export default CSSModules(NewNoteModal, styles)