Allow zotero://open-pdf/ to navigate to specific annotation by key

zotero://open-pdf/library/items/AABBCCDD?annotation=[annotation-key]

Fallback to a page if annotation is missing:
zotero://open-pdf/library/items/AABBCCDD?page=123&annotation=[annotation-key]

Fixes #2125
This commit is contained in:
Martynas Bagdonas 2021-08-06 10:56:26 +03:00
parent 6472321000
commit 9b3367f227
2 changed files with 6 additions and 4 deletions

View file

@ -1154,6 +1154,7 @@ function ZoteroProtocolHandler() {
if (parseInt(page) != page) {
page = null;
}
var annotation = params.annotation;
if (!results.length) {
Zotero.warn(`No item found for ${uriPath}`);
@ -1180,9 +1181,9 @@ function ZoteroProtocolHandler() {
}
var opened = false;
if (page) {
if (page || annotation) {
try {
opened = await Zotero.OpenPDF.openToPage(item, page);
opened = await Zotero.OpenPDF.openToPage(item, page, annotation);
}
catch (e) {
Zotero.logError(e);