citation dlg: Don't remove bubbles on Backspace on Windows/Linux (#5526)

On non-macOS platforms, Delete (not Backspace) on a table row
will remove all of this item's bubbles from the citation.
This is to be consistent with similar delete operation
handling in other tables.

On macOS, this is still done via Backspace as before.

Per https://github.com/zotero/zotero/pull/5518#discussion_r2310293170
This commit is contained in:
abaevbog 2025-09-04 02:50:50 -05:00 • committed by GitHub
parent 25a881255e
commit 4ae1ea1daf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -611,7 +611,7 @@ class LibraryLayout extends Layout {
itemsTree.addEventListener("mouseup", event => this._handleItemsViewRowClick(event), true);
// manually handle hover effect on +/- icon, since css :hover applies to the entire row
itemsTree.addEventListener("mousemove", event => this._handleItemsViewMouseMove(event));
// handle backspace to remove an item from citation
// handle backspace/delete to remove an item from citation
itemsTree.addEventListener("keypress", event => this._handleItemsViewKeyPress(event));
// only highlight bubbles of selected rows when the focus is in itemTree
// when focus leaves the items table, bubbles highlighting is removed
@ -733,9 +733,9 @@ class LibraryLayout extends Layout {
hoveredOverIcon.classList.add("hover");
}
// backspace in itemsView deletes items from the citation
// backspace/delete in itemsView deletes items from the citation
_handleItemsViewKeyPress(event) {
if (event.key == "Backspace") {
if (event.key == "Delete" || Zotero.isMac && event.key == "Backspace") {
let itemsToRemove = this.itemsView.getSelectedItems();
for (let item of itemsToRemove) {
let items = CitationDataManager.getItems({ itemID: item.id });