From f50e8b0b350fd456b8b5abe9c2fcfb9c7b6483b2 Mon Sep 17 00:00:00 2001 From: Bogdan Abaev Date: Wed, 11 Jun 2025 12:53:05 -0700 Subject: [PATCH] do not open hidden Zotero window on connector save And fix regression where selecting a collection in connector would always switch to the library tab. It was originally added in https://github.com/zotero/zotero/pull/5020 but was lost after https://github.com/zotero/zotero/pull/5148. --- chrome/content/zotero/xpcom/server/saveSession.js | 2 +- chrome/content/zotero/zoteroPane.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/server/saveSession.js b/chrome/content/zotero/xpcom/server/saveSession.js index 7f8f94ff1c..81508a1cc2 100644 --- a/chrome/content/zotero/xpcom/server/saveSession.js +++ b/chrome/content/zotero/xpcom/server/saveSession.js @@ -190,7 +190,7 @@ Zotero.Server.Connector.SaveSession = class { 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, noWindowRestore: true }); } } } diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index e432eb5266..c3fc74eae4 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3023,7 +3023,7 @@ var ZoteroPane = new function() Zotero.warn("ZoteroPane.selectItems() now takes an 'options' object -- update your code"); options = { inLibraryRoot: options }; } - let { inLibraryRoot, noTabSwitch } = options; + let { inLibraryRoot, noTabSwitch, noWindowRestore } = options; if (!itemIDs.length) { return false; } @@ -3034,7 +3034,7 @@ var ZoteroPane = new function() } // Restore window if it's in the dock - if (window.windowState == window.STATE_MINIMIZED) { + if (window.windowState == window.STATE_MINIMIZED && !noWindowRestore) { window.restore(); }