From ea135a0d285fde676ca55756a6ef10f137c57f8f Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 9 Jan 2018 20:16:09 +0000 Subject: [PATCH] Electron: Fixed logic of what note is used when right-clicking one or more notes --- ElectronClient/app/gui/NoteList.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ElectronClient/app/gui/NoteList.jsx b/ElectronClient/app/gui/NoteList.jsx index bc4c492845..3d54c2ea74 100644 --- a/ElectronClient/app/gui/NoteList.jsx +++ b/ElectronClient/app/gui/NoteList.jsx @@ -54,7 +54,16 @@ class NoteListComponent extends React.Component { } itemContextMenu(event) { - const noteIds = this.props.selectedNoteIds; + const currentItemId = event.currentTarget.getAttribute('data-id'); + if (!currentItemId) return; + + let noteIds = []; + if (this.props.selectedNoteIds.indexOf(currentItemId) < 0) { + noteIds = [currentItemId]; + } else { + noteIds = this.props.selectedNoteIds; + } + if (!noteIds.length) return; const notes = noteIds.map((id) => BaseModel.byId(this.props.notes, id)); @@ -163,6 +172,7 @@ class NoteListComponent extends React.Component { style={listItemTitleStyle} onClick={(event) => { onTitleClick(event, item) }} onDragStart={(event) => onDragStart(event) } + data-id={item.id} > {Note.displayTitle(item)}