mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
fix newNoteModal create note twice after double click quickly
This commit is contained in:
@@ -8,7 +8,7 @@ import { createMarkdownNote, createSnippetNote } from 'browser/lib/newNote'
|
|||||||
class NewNoteModal extends React.Component {
|
class NewNoteModal extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
this.lock = false
|
||||||
this.state = {}
|
this.state = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,9 +22,12 @@ class NewNoteModal extends React.Component {
|
|||||||
|
|
||||||
handleMarkdownNoteButtonClick (e) {
|
handleMarkdownNoteButtonClick (e) {
|
||||||
const { storage, folder, dispatch, location, params, config } = this.props
|
const { storage, folder, dispatch, location, params, config } = this.props
|
||||||
createMarkdownNote(storage, folder, dispatch, location, params, config).then(() => {
|
if (!this.lock) {
|
||||||
setTimeout(this.props.close, 200)
|
this.lock = true
|
||||||
})
|
createMarkdownNote(storage, folder, dispatch, location, params, config).then(() => {
|
||||||
|
setTimeout(this.props.close, 200)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMarkdownNoteButtonKeyDown (e) {
|
handleMarkdownNoteButtonKeyDown (e) {
|
||||||
@@ -36,9 +39,12 @@ class NewNoteModal extends React.Component {
|
|||||||
|
|
||||||
handleSnippetNoteButtonClick (e) {
|
handleSnippetNoteButtonClick (e) {
|
||||||
const { storage, folder, dispatch, location, params, config } = this.props
|
const { storage, folder, dispatch, location, params, config } = this.props
|
||||||
createSnippetNote(storage, folder, dispatch, location, params, config).then(() => {
|
if (!this.lock) {
|
||||||
setTimeout(this.props.close, 200)
|
this.lock = true
|
||||||
})
|
createSnippetNote(storage, folder, dispatch, location, params, config).then(() => {
|
||||||
|
setTimeout(this.props.close, 200)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSnippetNoteButtonKeyDown (e) {
|
handleSnippetNoteButtonKeyDown (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user