Expand search parents whith Select All shortcut in item tree

This commit is contained in:
Adomas Venčkauskas 2021-04-16 17:27:07 +03:00 committed by Dan Stillman
parent 1db2eb4aea
commit 6dce19d546
2 changed files with 8 additions and 3 deletions

View file

@ -492,7 +492,7 @@ class VirtualizedTable extends React.Component {
if (e.altKey) return; if (e.altKey) return;
const shiftSelect = e.shiftKey; const shiftSelect = e.shiftKey;
const movePivot = e.ctrlKey || e.metaKey; const movePivot = Zotero.isMac ? e.metaKey : e.ctrlKey;
const rowCount = this.props.getRowCount(); const rowCount = this.props.getRowCount();
switch (e.key) { switch (e.key) {
@ -554,9 +554,8 @@ class VirtualizedTable extends React.Component {
if (this.selection.selectEventsSuppressed) break; if (this.selection.selectEventsSuppressed) break;
this.invalidate(); this.invalidate();
if (!this.selection.selectEventsSuppressed) { if (!this.selection.selectEventsSuppressed) {
this.props.onSelectionChange(this, shouldDebounce); this.props.onSelectionChange(this, false);
} }
this.selection.rangedSelect(0, this.props.getRowCount()-1);
} }
break; break;

View file

@ -365,6 +365,7 @@ var ItemTree = class ItemTree extends LibraryTree {
? [] ? []
: newSearchItems.filter(item => !!item.parentItemID).map(item => item.parentItemID) : newSearchItems.filter(item => !!item.parentItemID).map(item => item.parentItemID)
); );
this._searchParentIDs = newSearchParentIDs;
newSearchItems = new Set(newSearchItems); newSearchItems = new Set(newSearchItems);
var newCellTextCache = {}; var newCellTextCache = {};
@ -1059,6 +1060,11 @@ var ItemTree = class ItemTree extends LibraryTree {
const _promise = Zotero.Tags.toggleItemsListTags(items, colorData.name); const _promise = Zotero.Tags.toggleItemsListTags(items, colorData.name);
return false; return false;
} }
else if (event.key == 'a' && (Zotero.isMac ? event.metaKey : event.ctrlKey)) {
if (!this.collectionTreeRow.isPublications()) {
this.expandMatchParents(this._searchParentIDs);
}
}
else if (event.key == '+' && !(event.ctrlKey || event.altKey || event.metaKey)) { else if (event.key == '+' && !(event.ctrlKey || event.altKey || event.metaKey)) {
this.expandAllRows(); this.expandAllRows();
return false; return false;