Add support for PDF navigation to pageLabel

This commit is contained in:
Martynas Bagdonas 2021-02-17 21:11:16 +02:00 committed by Dan Stillman
parent 16650b4ddf
commit 580d800286
2 changed files with 29 additions and 2 deletions

View file

@ -330,7 +330,34 @@ class EditorInstance {
}
return;
}
case 'openCitation': {
case 'openCitationPage': {
let { citation } = message;
if (!citation.citationItems.length) {
return;
}
let citationItem = citation.citationItems[0];
let item = await this._getItemFromURIs(citationItem.uris);
if (!item) {
return;
}
let attachments = Zotero.Items.get(item.getAttachments());
if (citationItem.locator && attachments.length === 1) {
await Zotero.Reader.open(attachments[0].id, { pageLabel: citationItem.locator });
}
else {
let zp = Zotero.getActiveZoteroPane();
if (zp) {
zp.selectItems([item.id]);
let win = Zotero.getMainWindow();
if (win) {
win.focus();
win.Zotero_Tabs.select('zotero-pane');
}
}
}
return;
}
case 'showCitationItem': {
let { citation } = message;
let items = [];
for (let citationItem of citation.citationItems) {

@ -1 +1 @@
Subproject commit 8001eb0c25c764ddf80f8b6b3a6fa120ac3113db
Subproject commit 0df9395811c1fa3161e447d9f776accb416a1e67