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

Add an event for deletion hotkey

This commit is contained in:
jacobherrington
2018-09-30 20:17:10 -05:00
parent 2ccd00a378
commit 4717e4fe3f
2 changed files with 8 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ class MarkdownNoteDetail extends React.Component {
const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT' const reversedType = this.state.editorType === 'SPLIT' ? 'EDITOR_PREVIEW' : 'SPLIT'
this.handleSwitchMode(reversedType) this.handleSwitchMode(reversedType)
}) })
ee.on('hotkey:deletenote', this.handleDeleteNote.bind(this))
ee.on('code:generate-toc', this.generateToc) ee.on('code:generate-toc', this.generateToc)
} }
@@ -293,6 +294,10 @@ class MarkdownNoteDetail extends React.Component {
}) })
} }
handleDeleteNote () {
this.handleTrashButtonClick()
}
renderEditor () { renderEditor () {
const { config, ignorePreviewPointerEvents } = this.props const { config, ignorePreviewPointerEvents } = this.props
const { note } = this.state const { note } = this.state

View File

@@ -3,5 +3,8 @@ import ee from 'browser/main/lib/eventEmitter'
module.exports = { module.exports = {
'toggleMode': () => { 'toggleMode': () => {
ee.emit('topbar:togglemodebutton') ee.emit('topbar:togglemodebutton')
},
'deleteNote': () => {
ee.emit('hotkey:deletenote')
} }
} }