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

feat: add right click notelist delete

This commit is contained in:
voidSatisfaction
2017-10-08 18:20:31 +09:00
parent c39e5c67f5
commit a7328e21f1
2 changed files with 15 additions and 1 deletions

View File

@@ -41,16 +41,18 @@ const TagElementList = (tags) => {
* @param {boolean} isActive
* @param {Object} note
* @param {Function} handleNoteClick
* @param {Function} handleNoteContextMenu
* @param {Function} handleDragStart
* @param {string} dateDisplay
*/
const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleDragStart }) => (
const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteContextMenu, handleDragStart }) => (
<div styleName={isActive
? 'item--active'
: 'item'
}
key={`${note.storage}-${note.key}`}
onClick={e => handleNoteClick(e, `${note.storage}-${note.key}`)}
onContextMenu={e => handleNoteContextMenu(e, `${note.storage}-${note.key}`)}
onDragStart={e => handleDragStart(e, note)}
draggable='true'
>

View File

@@ -338,6 +338,17 @@ class NoteList extends React.Component {
e.dataTransfer.setData('note', noteData)
}
handleNoteContextMenu (e, uniqueKey) {
this.handleNoteClick(e, uniqueKey)
let menu = new Menu()
menu.append(new MenuItem({
label: 'Delete Note',
click: () => ee.emit('detail:delete')
}))
menu.popup()
}
importFromFile () {
const { dispatch, location } = this.props
@@ -432,6 +443,7 @@ class NoteList extends React.Component {
note={note}
dateDisplay={dateDisplay}
key={key}
handleNoteContextMenu={this.handleNoteContextMenu.bind(this)}
handleNoteClick={this.handleNoteClick.bind(this)}
handleDragStart={this.handleDragStart.bind(this)}
/>