parent
89aaa10504
commit
10c8fc4c74
3 changed files with 17 additions and 3 deletions
|
@ -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'));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue