mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
arrowUp/down in duplicates view will select the set (#4800)
When duplicates collectionTreeRow is selected, arrowUp/down within itemTree will select the entire previous/next set of duplicate items. Per discussion based on https://forums.zotero.org/discussion/119217/bug-zotero-7-beta-duplicates-collection-navigation-via-arrow-keys
This commit is contained in:
parent
682cceca2d
commit
e2905b22ad
1 changed files with 18 additions and 0 deletions
|
|
@ -978,6 +978,24 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
this.collapseAllRows();
|
||||
return false;
|
||||
}
|
||||
// On arrowUp/down without modifiers in duplicates view, select the entire set
|
||||
else if (this.collectionTreeRow.isDuplicates() && ["ArrowUp", "ArrowDown"].includes(event.key)
|
||||
&& !event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
||||
// Find the first row outside of the current consecutive set of rows
|
||||
let findNextRow = index => (event.key == "ArrowUp" ? index - 1 : index + 1);
|
||||
let nextRowIndex = findNextRow(this.selection.focused);
|
||||
while (this.selection.selected.has(nextRowIndex)) {
|
||||
nextRowIndex = findNextRow(nextRowIndex);
|
||||
}
|
||||
if (nextRowIndex < 0 || nextRowIndex > this._rows.length - 1) return false;
|
||||
// Set that row as focused and select its item as the next set of duplicates
|
||||
let nextItem = this._rows[nextRowIndex].ref;
|
||||
var setItemIDs = this.collectionTreeRow.ref.getSetItemsByItemID(nextItem.id);
|
||||
this.selection.focused = nextRowIndex;
|
||||
|
||||
this.selectItems(setItemIDs);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue