Fix the "Edit → Select All" menu option not selecting items (#5626)

This commit is contained in:
Tom Najdek 2025-11-13 22:11:48 +01:00 • committed by GitHub
parent 3f8a0b5b86
commit 8a57f6c45b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 2 deletions

View file

@ -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;

View file

@ -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();

View file

@ -125,6 +125,7 @@
<command id="cmd_zotero_newChildURLAttachment" oncommand="ZoteroPane.addAttachmentFromURI(true, ZoteroPane.getSelectedItems()[0].id)"/>
<command id="cmd_zotero_newStandaloneNote" oncommand="ZoteroPane_Local.newNote(event.shiftKey);"/>
<command id="cmd_zotero_newChildNote" oncommand="ZoteroPane_Local.newChildNote(event.shiftKey);"/>
<command id="cmd_zotero_selectAll" oncommand="ZoteroPane.selectAll();"/>
<command id="cmd_zotero_showTabsMenu" oncommand="Zotero_Tabs.showTabsMenu()"/>
</commandset>
@ -404,7 +405,7 @@
<menuseparator/>
<menuitem id="menu_selectAll"
key="key_selectAll"
command="cmd_selectAll" data-l10n-id="text-action-select-all"/>
command="cmd_zotero_selectAll" data-l10n-id="text-action-select-all"/>
<menuseparator class="menu-type-reader pdf"/>
<menuitem
id="edit-menuitem-rotate-left"