1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-26 18:58:21 +02:00

Electron: Fixed logic of what note is used when right-clicking one or more notes

This commit is contained in:
Laurent Cozic 2018-01-09 20:16:09 +00:00
parent f67e4a03e4
commit ea135a0d28

View File

@ -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)}
</a>