Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions browser/main/NoteList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,23 @@ class NoteList extends React.Component {

handleNoteContextMenu (e, uniqueKey) {
const { location } = this.props
const targetIndex = this.getTargetIndex()
let note = this.notes[targetIndex]
const label = note.isPinned ? 'Remove pin' : 'Pin to Top'
const note = this.notes.find((note) => {
const noteKey = `${note.storage}-${note.key}`
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/)) {
menu.append(new MenuItem({
label: label,
label: pinLabel,
click: (e) => this.pinToTop(e, uniqueKey)
}))
}
menu.append(new MenuItem({
label: 'Delete Note',
label: deleteLabel,
click: (e) => this.deleteNote(e, uniqueKey)
}))
menu.popup()
Expand All @@ -377,6 +381,7 @@ class NoteList extends React.Component {
const currentStorage = data.storageMap.get(storageKey)
const currentFolder = _.find(currentStorage.folders, {key: folderKey})

this.handleNoteClick(e, uniqueKey)
const targetIndex = this.getTargetIndex()
let note = this.notes[targetIndex]
note.isPinned = !note.isPinned
Expand Down