1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

select proper notes for dragging

When the dragged target note is included in the selected notes, keeps the current selected notes, otherwise, replace the selected notes by the dragged target
This commit is contained in:
yosmoc
2018-04-30 22:34:15 +02:00
parent dc60be404a
commit 2d0f7589ea

View File

@@ -455,7 +455,14 @@ class NoteList extends React.Component {
}
handleDragStart (e, note) {
const { selectedNoteKeys } = this.state
let { selectedNoteKeys } = this.state
const noteKey = getNoteKey(note)
if (!selectedNoteKeys.includes(noteKey)) {
selectedNoteKeys = []
selectedNoteKeys.push(noteKey)
}
const notes = this.notes.map((note) => Object.assign({}, note))
const selectedNotes = findNotesByKeys(notes, selectedNoteKeys)
const noteData = JSON.stringify(selectedNotes)