Fix "Open in Library" from Quick Format popup if main window is closed
Possible now on macOS
This commit is contained in:
parent
c59ae5cf40
commit
6bcf92db46
|
@ -1301,15 +1301,23 @@ var Zotero_QuickFormat = new function () {
|
||||||
/**
|
/**
|
||||||
* Show an item in the library it came from
|
* Show an item in the library it came from
|
||||||
*/
|
*/
|
||||||
this.showInLibrary = function() {
|
this.showInLibrary = async function() {
|
||||||
var id = panelRefersToBubble.citationItem.id;
|
var id = panelRefersToBubble.citationItem.id;
|
||||||
var pane = Zotero.getActiveZoteroPane();
|
var pane = Zotero.getActiveZoteroPane();
|
||||||
if(pane) {
|
// Open main window if it's not open (Mac)
|
||||||
pane.show();
|
if (!pane) {
|
||||||
pane.selectItem(id);
|
let win = Zotero.openMainWindow();
|
||||||
} else {
|
await new Zotero.Promise((resolve) => {
|
||||||
var win = window.open('zotero://select/item/'+id);
|
let onOpen = function () {
|
||||||
|
win.removeEventListener('load', onOpen);
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
win.addEventListener('load', onOpen);
|
||||||
|
});
|
||||||
|
pane = win.ZoteroPane;
|
||||||
}
|
}
|
||||||
|
pane.show();
|
||||||
|
pane.selectItem(id);
|
||||||
|
|
||||||
// Pull window to foreground
|
// Pull window to foreground
|
||||||
Zotero.Integration.activate(pane.document.defaultView);
|
Zotero.Integration.activate(pane.document.defaultView);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user