diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index 507a608504..61e3aaf280 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -551,7 +551,13 @@ class EditorInstance { this.onNavigate(uri, { position }); } else { - await Zotero.Reader.openURI(uri, { position }); + let zp = Zotero.getActiveZoteroPane(); + if (zp) { + let item = await Zotero.URI.getURIItem(uri); + if (item) { + zp.viewPDF(item.id, { position }); + } + } } return; } @@ -567,7 +573,10 @@ class EditorInstance { } let attachments = Zotero.Items.get(item.getAttachments()).filter(x => x.isPDFAttachment()); if (citationItem.locator && attachments.length === 1) { - await Zotero.Reader.open(attachments[0].id, { pageLabel: citationItem.locator }); + let zp = Zotero.getActiveZoteroPane(); + if (zp) { + zp.viewPDF(attachments[0].id, { pageLabel: citationItem.locator }); + } } else { this._showInLibrary(item.id); diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 8fcf351110..8cd2ab9d7f 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -4175,7 +4175,7 @@ var ZoteroPane = new function() }); - this.viewAttachment = Zotero.serial(async function (itemIDs, event, noLocateOnMissing, forceExternalViewer) { + this.viewAttachment = Zotero.serial(async function (itemIDs, event, noLocateOnMissing, extraData) { // If view isn't editable, don't show Locate button, since the updated // path couldn't be sent back up if (!this.collectionsView.editable) { @@ -4210,7 +4210,11 @@ var ZoteroPane = new function() // TEMP if (Zotero.isPDFBuild && (library.libraryType == 'user' || Zotero.enablePDFBuildForGroups)) { let originalEvent = event && event.originalEvent || event; - this.viewPDF(itemID, originalEvent && originalEvent.shiftKey); + await Zotero.Reader.open( + itemID, + extraData && extraData.location, + originalEvent && originalEvent.shiftKey + ); return; } let pdfHandler = Zotero.Prefs.get("fileHandler.pdf"); @@ -4378,8 +4382,8 @@ var ZoteroPane = new function() } }); - this.viewPDF = function (itemID, openWindow) { - Zotero.Reader.open(itemID, null, openWindow); + this.viewPDF = async function (itemID, location) { + await this.viewAttachment(itemID, null, false, { location }); }; diff --git a/note-editor b/note-editor index 24012c75dc..0d2f920026 160000 --- a/note-editor +++ b/note-editor @@ -1 +1 @@ -Subproject commit 24012c75dcf6d7a30c17340b1999c8e106e111bf +Subproject commit 0d2f9200260f3c2e72487373e3ad10d7e9d1d6aa