mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Fix enable no focus right click pin to top and show right context menu
This commit is contained in:
@@ -351,19 +351,23 @@ class NoteList extends React.Component {
|
|||||||
|
|
||||||
handleNoteContextMenu (e, uniqueKey) {
|
handleNoteContextMenu (e, uniqueKey) {
|
||||||
const { location } = this.props
|
const { location } = this.props
|
||||||
const targetIndex = this.getTargetIndex()
|
const note = this.notes.find((note) => {
|
||||||
let note = this.notes[targetIndex]
|
const noteKey = `${note.storage}-${note.key}`
|
||||||
const label = note.isPinned ? 'Remove pin' : 'Pin to Top'
|
return noteKey === uniqueKey
|
||||||
|
})
|
||||||
|
|
||||||
let menu = new Menu()
|
const pinLabel = note.isPinned ? 'Remove pin' : 'Pin to Top'
|
||||||
|
const deleteLabel = 'Delete Note'
|
||||||
|
|
||||||
|
const menu = new Menu()
|
||||||
if (!location.pathname.match(/\/home|\/starred|\/trash/)) {
|
if (!location.pathname.match(/\/home|\/starred|\/trash/)) {
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: label,
|
label: pinLabel,
|
||||||
click: (e) => this.pinToTop(e, uniqueKey)
|
click: (e) => this.pinToTop(e, uniqueKey)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Delete Note',
|
label: deleteLabel,
|
||||||
click: (e) => this.deleteNote(e, uniqueKey)
|
click: (e) => this.deleteNote(e, uniqueKey)
|
||||||
}))
|
}))
|
||||||
menu.popup()
|
menu.popup()
|
||||||
@@ -377,6 +381,7 @@ class NoteList extends React.Component {
|
|||||||
const currentStorage = data.storageMap.get(storageKey)
|
const currentStorage = data.storageMap.get(storageKey)
|
||||||
const currentFolder = _.find(currentStorage.folders, {key: folderKey})
|
const currentFolder = _.find(currentStorage.folders, {key: folderKey})
|
||||||
|
|
||||||
|
this.handleNoteClick(e, uniqueKey)
|
||||||
const targetIndex = this.getTargetIndex()
|
const targetIndex = this.getTargetIndex()
|
||||||
let note = this.notes[targetIndex]
|
let note = this.notes[targetIndex]
|
||||||
note.isPinned = !note.isPinned
|
note.isPinned = !note.isPinned
|
||||||
|
|||||||
Reference in New Issue
Block a user