Fix external zotero:// links

This commit is contained in:
Dan Stillman 2017-07-29 17:13:46 -04:00
parent a6564e92d7
commit 4c9f389aa8

View File

@ -540,15 +540,19 @@ ZoteroCommandLineHandler.prototype = {
if (param) { if (param) {
var uri = cmdLine.resolveURI(param); var uri = cmdLine.resolveURI(param);
if(uri.schemeIs("zotero")) { if(uri.schemeIs("zotero")) {
addInitCallback(function (Zotero) {
Zotero.uiReadyPromise
.then(function () {
// Check for existing window and focus it // Check for existing window and focus it
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator); .getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser"); var win = wm.getMostRecentWindow("navigator:browser");
if(win) { if (win) {
win.focus(); win.focus();
Components.classes["@mozilla.org/network/protocol;1?name=zotero"] win.ZoteroPane.loadURI(uri.spec)
.getService().newChannel(uri);
} }
});
});
} }
// See below // See below
else if (uri.schemeIs("file")) { else if (uri.schemeIs("file")) {