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();
|
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 () {
|
this.init = function () {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<TabBar
|
<TabBar
|
||||||
|
|
|
@ -1372,6 +1372,17 @@ class Reader {
|
||||||
this.triggerAnnotationsImportCheck(itemID);
|
this.triggerAnnotationsImportCheck(itemID);
|
||||||
let reader;
|
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) {
|
if (openInWindow) {
|
||||||
reader = this._readers.find(r => r._itemID === itemID && (r instanceof ReaderWindow));
|
reader = this._readers.find(r => r._itemID === itemID && (r instanceof ReaderWindow));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue