Skip to content

Commit

Permalink
Fix external zotero:// links
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed Jul 29, 2017
1 parent a6564e9 commit 4c9f389
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions components/zotero-service.js
Expand Up @@ -540,15 +540,19 @@ ZoteroCommandLineHandler.prototype = {
if (param) {
var uri = cmdLine.resolveURI(param);
if(uri.schemeIs("zotero")) {
// Check for existing window and focus it
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
if(win) {
win.focus();
Components.classes["@mozilla.org/network/protocol;1?name=zotero"]
.getService().newChannel(uri);
}
addInitCallback(function (Zotero) {
Zotero.uiReadyPromise
.then(function () {
// Check for existing window and focus it
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
if (win) {
win.focus();
win.ZoteroPane.loadURI(uri.spec)
}
});
});
}
// See below
else if (uri.schemeIs("file")) {
Expand Down

0 comments on commit 4c9f389

Please sign in to comment.