mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-12 17:26:17 +00:00
Improvement on the code
The improvement was suggested by github
This commit is contained in:
@@ -427,12 +427,14 @@ class NoteList extends React.Component {
|
||||
selectedNoteKeys.push(uniqueKey)
|
||||
|
||||
if (shiftKeyDown && hasSelectedNoteKey) {
|
||||
const firstSelectedNoteIndex =
|
||||
Math.max(this.getNoteIndexByKey(selectedNoteKeys[0]),
|
||||
this.state.firstShiftSelectedNoteIndex)
|
||||
const firstSelectedNoteIndex = selectedNoteKeys[0] > this.state.firstShiftSelectedNoteIndex
|
||||
? selectedNoteKeys[0] : this.state.firstShiftSelectedNoteIndex
|
||||
const lastSelectedNoteIndex = this.getNoteIndexByKey(uniqueKey)
|
||||
const startIndex = Math.min(firstSelectedNoteIndex, lastSelectedNoteIndex)
|
||||
const endIndex = Math.max(firstSelectedNoteIndex, lastSelectedNoteIndex)
|
||||
const startIndex = firstSelectedNoteIndex < lastSelectedNoteIndex
|
||||
? firstSelectedNoteIndex : lastSelectedNoteIndex
|
||||
const endIndex = firstSelectedNoteIndex > lastSelectedNoteIndex
|
||||
? firstSelectedNoteIndex : lastSelectedNoteIndex
|
||||
|
||||
selectedNoteKeys = []
|
||||
for (let i = startIndex; i <= endIndex; i++) {
|
||||
selectedNoteKeys.push(this.notes[i].key)
|
||||
|
||||
Reference in New Issue
Block a user