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:
parent
6472321000
commit
9b3367f227
2 changed files with 6 additions and 4 deletions
|
@ -26,7 +26,7 @@
|
|||
/* eslint-disable array-element-newline */
|
||||
|
||||
Zotero.OpenPDF = {
|
||||
openToPage: async function (pathOrItem, page) {
|
||||
openToPage: async function (pathOrItem, page, annotationKey) {
|
||||
var path;
|
||||
if (pathOrItem == 'string') {
|
||||
Zotero.logError("Zotero.OpenPDF.openToPage() now takes a Zotero.Item rather than a path "
|
||||
|
@ -39,7 +39,8 @@ Zotero.OpenPDF = {
|
|||
// TEMP
|
||||
if (Zotero.isPDFBuild && (library.libraryType == 'user' || Zotero.enablePDFBuildForGroups)) {
|
||||
let location = {
|
||||
pageIndex: page - 1
|
||||
annotationKey,
|
||||
pageIndex: page && page - 1
|
||||
};
|
||||
await Zotero.Reader.open(item.id, location);
|
||||
return true;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue