From b5ea925d024d0c5697b48d4b66ca6bdbe083d176 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 30 Aug 2021 14:56:09 +0300 Subject: [PATCH] Jump back to the opening tab even if the PDF was already open Fixes #1985 --- chrome/content/zotero/tabs.js | 5 +++-- chrome/content/zotero/xpcom/reader.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index f6a0160765..304254bbc3 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -288,13 +288,14 @@ var Zotero_Tabs = new function () { * Select a tab * * @param {String} id + * @param {Boolean} reopening */ - this.select = function (id) { + this.select = function (id, reopening) { var { tab } = this._getTab(id); if (!tab || tab.id === this._selectedID) { return; } - this._prevSelectedID = null; + this._prevSelectedID = reopening ? this._selectedID : null; this._selectedID = id; this.deck.selectedIndex = Array.from(this.deck.children).findIndex(x => x.id == id); this._update(); diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 1d6190cc2f..57adb035a8 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -996,7 +996,7 @@ class Reader { if (reader) { if (reader instanceof ReaderTab) { - reader._window.Zotero_Tabs.select(reader.tabID); + reader._window.Zotero_Tabs.select(reader.tabID, true); } if (location) {