diff --git a/chrome/content/zotero/advancedSearch.js b/chrome/content/zotero/advancedSearch.js index 89e6e10ec4..019ae36332 100644 --- a/chrome/content/zotero/advancedSearch.js +++ b/chrome/content/zotero/advancedSearch.js @@ -183,7 +183,7 @@ var ZoteroAdvancedSearch = new function() { return; } - lastWin.ZoteroPane.selectItems(items.map(item => item.id), false); + lastWin.ZoteroPane.selectItems(items.map(item => item.id)); lastWin.focus(); } } diff --git a/chrome/content/zotero/progressQueueDialog.jsx b/chrome/content/zotero/progressQueueDialog.jsx index 918021f3c5..7b92cc6453 100644 --- a/chrome/content/zotero/progressQueueDialog.jsx +++ b/chrome/content/zotero/progressQueueDialog.jsx @@ -62,7 +62,7 @@ async function _handleActivate(event, indices) { let win = Services.wm.getMostRecentWindow("navigator:browser"); if (win) { - win.ZoteroPane.selectItem(itemID, false, true); + win.ZoteroPane.selectItem(itemID); win.focus(); } } diff --git a/chrome/content/zotero/xpcom/connector/server_connector.js b/chrome/content/zotero/xpcom/connector/server_connector.js index 403f41fd2b..2da9c485c3 100644 --- a/chrome/content/zotero/xpcom/connector/server_connector.js +++ b/chrome/content/zotero/xpcom/connector/server_connector.js @@ -305,7 +305,7 @@ Zotero.Server.Connector.SaveSession.prototype.update = async function (targetID, item = item.isTopLevelItem() ? item : item.parentItem; // Don't select if in trash if (!item.deleted) { - await zp.selectItem(item.id); + await zp.selectItem(item.id, { noTabSwitch: true }); } } }; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 08b0c8b21c..a4b4f0bdb7 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -2985,15 +2985,20 @@ var ZoteroPane = new function() }; - this.selectItem = async function (itemID, inLibraryRoot) { + this.selectItem = async function (itemID, options) { if (!itemID) { return false; } - return this.selectItems([itemID], inLibraryRoot); + return this.selectItems([itemID], options); }; - this.selectItems = async function (itemIDs, inLibraryRoot) { + this.selectItems = async function (itemIDs, options = {}) { + if (typeof options == "boolean") { + Zotero.warn("ZoteroPane.selectItems() now takes an 'options' object -- update your code"); + options = { inLibraryRoot: options }; + } + let { inLibraryRoot, noTabSwitch } = options; if (!itemIDs.length) { return false; } @@ -3019,7 +3024,10 @@ var ZoteroPane = new function() document.getElementById(ZoteroPane.itemsView.id).focus(); } - Zotero_Tabs.select('zotero-pane', false, { focusElementID: ZoteroPane.itemsView.id }); + if (!noTabSwitch) { + Zotero_Tabs.select('zotero-pane', false, { focusElementID: ZoteroPane.itemsView.id }); + } + return true; };