Try to open external PDF reader to page number for "Show on Page"
PDF-handling code from `ZoteroPane.viewAttachment()` predates `Zotero.OpenPDF` and didn't handle page numbers for external PDF readers, so when called from "Show on Page" in a note (via `ZoteroPane.viewPDF()`) it just launched the file itself in the specified handler or via the OS. For now, change to use `Zotero.OpenPDF.openToPage()` when there's a page number. Later we should use `Zotero.OpenPDF` for everything, but that code is more complicated than just using `launchFile()`, so we'll need to do some testing (particularly on Linux) to see what's best. (Note that "Show on Page" with an external reader doesn't make a ton of sense, since you can't actually see the annotation, but opening the right page is better than nothing.) Fixes #2612
This commit is contained in:
parent
0c0afb129b
commit
693f9a7e1b
1 changed files with 12 additions and 0 deletions
|
@ -4284,7 +4284,19 @@ var ZoteroPane = new function()
|
|||
);
|
||||
return;
|
||||
}
|
||||
// Try to open external reader to page number if specified
|
||||
else {
|
||||
let pageIndex = extraData?.location?.position?.pageIndex;
|
||||
if (pageIndex !== undefined) {
|
||||
await Zotero.OpenPDF.openToPage(
|
||||
item,
|
||||
parseInt(pageIndex) + 1
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Custom PDF handler
|
||||
// TODO: Remove this and unify with Zotero.OpenPDF
|
||||
if (pdfHandler != 'system') {
|
||||
try {
|
||||
if (await OS.File.exists(pdfHandler)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue