1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Updated the condition with more appropriate naming

This commit is contained in:
richardtks
2018-11-10 19:39:44 +08:00
parent 3df743f47b
commit ad7b155a99

View File

@@ -412,6 +412,7 @@ class NoteList extends React.Component {
let { selectedNoteKeys } = this.state
const { ctrlKeyDown, shiftKeyDown } = this.state
let firstShiftSelectedNoteIndex = -1
const hasSelectedNoteKey = selectedNoteKeys.length > 0
if (ctrlKeyDown && selectedNoteKeys.includes(uniqueKey)) {
const newSelectedNoteKeys = selectedNoteKeys.filter((noteKey) => noteKey !== uniqueKey)
@@ -425,7 +426,7 @@ class NoteList extends React.Component {
}
selectedNoteKeys.push(uniqueKey)
if (shiftKeyDown && selectedNoteKeys.length > 0) {
if (shiftKeyDown && hasSelectedNoteKey) {
const firstSelectedNoteIndex =
Math.max(this.getNoteIndexByKey(selectedNoteKeys[0]),
this.state.firstShiftSelectedNoteIndex)