-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: select multiple envelopes by holding shift directly
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
- Loading branch information
1 parent
e88add6
commit a126ab3
Showing
2 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -548,12 +548,15 @@ export default { | |
this.setEnvelopeSelected(envelope, selected) | ||
}, | ||
onEnvelopeSelectMultiple(envelope, index) { | ||
if (this.lastToggledIndex === undefined) { | ||
const lastToggledIndex = this.lastToggledIndex | ||
?? this.findSelectionIndex(parseInt(this.$route.params.threadId)) | ||
?? undefined | ||
if (lastToggledIndex === undefined) { | ||
return | ||
} | ||
const start = Math.min(this.lastToggledIndex, index) | ||
const end = Math.max(this.lastToggledIndex, index) | ||
const start = Math.min(lastToggledIndex, index) | ||
const end = Math.max(lastToggledIndex, index) | ||
const selected = this.selection.includes(envelope.databaseId) | ||
for (let i = start; i <= end; i++) { | ||
this.setEnvelopeSelected(this.sortedEnvelops[i], !selected) | ||
|
@@ -585,6 +588,21 @@ export default { | |
this.showMoveModal = false | ||
this.unselectAll() | ||
}, | ||
/** | ||
* Find the envelope list index of a given envelope's database id. | ||
* | ||
* @param {int} databaseId | ||
Check warning on line 594 in src/components/EnvelopeList.vue GitHub Actions / NPM lint
Check warning on line 594 in src/components/EnvelopeList.vue GitHub Actions / NPM lint
|
||
* @return {int|undefined} Index or undefined if not found in the envelope list | ||
*/ | ||
findSelectionIndex(databaseId) { | ||
for (const [index, envelope] of this.sortedEnvelops.entries()) { | ||
if (envelope.databaseId === databaseId) { | ||
return index | ||
} | ||
} | ||
return undefined | ||
}, | ||
}, | ||
} | ||
</script> | ||
|