diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index a661f94b44..ac77c3fa12 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -319,7 +319,8 @@ var Zotero_Tabs = new function () { this.close(tab.id); Zotero.Reader.open(tab.data.itemID, null, { title: tab.title, - tabIndex + tabIndex, + allowDuplicate: true }); return; } @@ -485,6 +486,18 @@ var Zotero_Tabs = new function () { } }); menupopup.appendChild(menuitem); + // Duplicate tab + menuitem = document.createElement('menuitem'); + menuitem.setAttribute('label', Zotero.getString('tabs.duplicate')); + menuitem.addEventListener('command', () => { + var { tab, tabIndex } = this._getTab(id); + if (tab.data.itemID) { + tabIndex++; + Zotero.Reader.open(tab.data.itemID, null, { tabIndex, allowDuplicate: true }); + + } + }); + popup.appendChild(menuitem); // Separator popup.appendChild(document.createElement('menuseparator')); } diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 77434ff0a5..4d097b127f 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -1270,7 +1270,7 @@ class Reader { await this.open(item.id, location, options); } - async open(itemID, location, { title, tabIndex, openInBackground, openInWindow } = {}) { + async open(itemID, location, { title, tabIndex, openInBackground, openInWindow, allowDuplicate } = {}) { this._loadSidebarState(); this.triggerAnnotationsImportCheck(itemID); let reader; @@ -1278,7 +1278,7 @@ class Reader { if (openInWindow) { reader = this._readers.find(r => r._itemID === itemID && (r instanceof ReaderWindow)); } - else { + else if (!allowDuplicate) { reader = this._readers.find(r => r._itemID === itemID); } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index c05499b11d..8f1ede137f 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -1404,5 +1404,6 @@ tabs.move = Move Tab tabs.moveToStart = Move to Start tabs.moveToEnd = Move to End tabs.moveToWindow = Move to New Window +tabs.duplicate = Duplicate Tab tabs.undoClose = Reopen Closed Tab;Reopen Closed Tabs tabs.closeOther = Close Other Tabs