1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Electron: Fixes #560: Drag the note that was clicked, which might be different from the note that was selected

This commit is contained in:
Laurent Cozic 2018-06-10 01:27:20 +01:00
parent b0e57a5990
commit e9f938b0fb

View File

@ -156,7 +156,18 @@ class NoteListComponent extends React.Component {
}
const onDragStart = (event) => {
const noteIds = this.props.selectedNoteIds;
let noteIds = [];
// Here there is two cases:
// - If multiple notes are selected, we drag the group
// - If only one note is selected, we drag the note that was clicked on (which might be different from the currently selected note)
if (this.props.selectedNoteIds.length >= 2) {
noteIds = this.props.selectedNoteIds;
} else {
const clickedNoteId = event.currentTarget.getAttribute('data-id');
if (clickedNoteId) noteIds.push(clickedNoteId);
}
if (!noteIds.length) return;
event.dataTransfer.setDragImage(new Image(), 1, 1);