1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

show delete confirmation dialog

This commit is contained in:
Maurits Lourens
2017-12-21 15:57:27 +01:00
parent 7c8e19c681
commit 3bba5442bd
3 changed files with 33 additions and 1 deletions

View File

@@ -175,6 +175,7 @@ class SnippetNoteDetail extends React.Component {
handleTrashButtonClick (e) {
const { note } = this.state
const { isTrashed } = note
const { config } = this.props
if (isTrashed) {
const dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
@@ -198,6 +199,16 @@ class SnippetNoteDetail extends React.Component {
ee.once('list:moved', dispatchHandler)
})
} else {
if (config.ui.confirmDeletion) {
const dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Confirm note deletion',
detail: 'Are you sure you want to move the note to the trash?',
buttons: ['Confirm', 'Cancel']
})
if (dialogueButtonIndex === 1) return
}
note.isTrashed = true
this.setState({