From 883b4c4c26a5602bed148c3d2d8a4e8e9d12229b Mon Sep 17 00:00:00 2001 From: Max Buranbaev Date: Tue, 3 Jul 2018 10:27:13 +0500 Subject: [PATCH 1/2] adding timeout on creating a note --- browser/main/modals/NewNoteModal.js | 86 +++++++++++++++++------------ 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/browser/main/modals/NewNoteModal.js b/browser/main/modals/NewNoteModal.js index 185004e7..59c6d80a 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,7 +85,7 @@ 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') @@ -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) From 3c8337cf544eb7c63e14bc809cddb1bfa05ed39a Mon Sep 17 00:00:00 2001 From: Max Buranbaev Date: Tue, 3 Jul 2018 10:29:22 +0500 Subject: [PATCH 2/2] adding timeout one creating a snippet --- browser/main/modals/NewNoteModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/modals/NewNoteModal.js b/browser/main/modals/NewNoteModal.js index 59c6d80a..b748587c 100644 --- a/browser/main/modals/NewNoteModal.js +++ b/browser/main/modals/NewNoteModal.js @@ -89,7 +89,7 @@ class NewNoteModal extends React.Component { }) ee.emit('list:jump', noteHash) ee.emit('detail:focus') - this.props.close() + setTimeout(this.props.close, 200) }) }