parent
9190eb8f34
commit
098886bcb6
2 changed files with 16 additions and 0 deletions
|
@ -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(
|
||||
<TabBar
|
||||
|
|
|
@ -1372,6 +1372,17 @@ class Reader {
|
|||
this.triggerAnnotationsImportCheck(itemID);
|
||||
let reader;
|
||||
|
||||
if (!allowDuplicate) {
|
||||
let win = Zotero.getMainWindow();
|
||||
if (win) {
|
||||
let existingTabID = win.Zotero_Tabs.getTabIDByItemID(itemID);
|
||||
if (existingTabID) {
|
||||
win.Zotero_Tabs.select(existingTabID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (openInWindow) {
|
||||
reader = this._readers.find(r => r._itemID === itemID && (r instanceof ReaderWindow));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue