1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

[api-minor] Support Named-actions in the outline (issue 15367)

Apparently this is implemented in e.g. Adobe Reader, and the specification does support it, however it cannot be commonly used in real-world PDF documents since it took over ten years for this feature to be requested.
This commit is contained in:
Jonas Jenwald 2022-08-30 18:40:27 +02:00
parent 86370bd5c5
commit 216b86a082
5 changed files with 38 additions and 2 deletions

View file

@ -109,13 +109,21 @@ class PDFOutlineViewer extends BaseTreeViewer {
/**
* @private
*/
_bindLink(element, { url, newWindow, dest }) {
_bindLink(element, { url, newWindow, action, dest }) {
const { linkService } = this;
if (url) {
linkService.addLinkAttributes(element, url, newWindow);
return;
}
if (action) {
element.href = linkService.getAnchorUrl("");
element.onclick = () => {
linkService.executeNamedAction(action);
return false;
};
return;
}
element.href = linkService.getDestinationHash(dest);
element.onclick = evt => {