diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index bfb55b7938..f2549b560a 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -194,6 +194,10 @@ class TreeSelection { } this._updateTree(); } + + selectAll() { + this.rangedSelect(0, this._tree.props.getRowCount() - 1, false, true); + } /** * Performs a shift-select from current pivot to provided index. Updates focused item to index. @@ -597,7 +601,7 @@ class VirtualizedTable extends React.Component { if (this.props.multiSelect && !e.shiftKey && (Zotero.isMac ? (e.metaKey && !e.ctrlKey) : e.ctrlKey)) { - this.selection.rangedSelect(0, this.props.getRowCount()-1, false, true); + this.selection.selectAll(); } break; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 0a5b27cb28..294f6c9da6 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3121,6 +3121,18 @@ var ZoteroPane = new function () { return true; }; + this.selectAll = function () { + if (this.itemsView.domEl.contains(document.activeElement)) { + this.itemsView.selection.selectAll(); + } + else { + const command = "cmd_selectAll"; + let controller = document.commandDispatcher.getControllerForCommand(command); + if (controller && controller.isCommandEnabled(command)) { + controller.doCommand(command); + } + } + }; this.getSelectedLibraryID = function () { return this.collectionsView.getSelectedLibraryID(); diff --git a/chrome/content/zotero/zoteroPane.xhtml b/chrome/content/zotero/zoteroPane.xhtml index da9abb1d8b..4809c5bf02 100644 --- a/chrome/content/zotero/zoteroPane.xhtml +++ b/chrome/content/zotero/zoteroPane.xhtml @@ -125,6 +125,7 @@ + @@ -404,7 +405,7 @@ + command="cmd_zotero_selectAll" data-l10n-id="text-action-select-all"/>