From 098886bcb6dc2a61810addccdaaa60846366f751 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Fri, 5 Aug 2022 18:22:30 +0300 Subject: [PATCH] Select existing unloaded tab instead of opening a new one Fixes #2740 --- chrome/content/zotero/tabs.js | 5 +++++ chrome/content/zotero/xpcom/reader.js | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index 6f858c953f..7410bcf333 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -84,6 +84,11 @@ var Zotero_Tabs = new function () { window.Zotero_Tooltip.stop(); }; + this.getTabIDByItemID = function (itemID) { + let tab = this._tabs.find(tab => tab.data && tab.data.itemID === itemID); + return tab && tab.id; + }; + this.init = function () { ReactDOM.render( r._itemID === itemID && (r instanceof ReaderWindow)); }