mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Merge pull request #15377 from Snuffleupagus/SetOCGState
[api-minor] Add basic support for the `SetOCGState` action (issue 15372)
This commit is contained in:
commit
50d72fc111
10 changed files with 185 additions and 31 deletions
|
@ -597,6 +597,9 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
} else if (data.action) {
|
||||
this._bindNamedAction(link, data.action);
|
||||
isBound = true;
|
||||
} else if (data.setOCGState) {
|
||||
this.#bindSetOCGState(link, data.setOCGState);
|
||||
isBound = true;
|
||||
} else if (data.dest) {
|
||||
this._bindLink(link, data.dest);
|
||||
isBound = true;
|
||||
|
@ -678,6 +681,20 @@ class LinkAnnotationElement extends AnnotationElement {
|
|||
link.className = "internalLink";
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind SetOCGState actions to the link element.
|
||||
* @param {Object} link
|
||||
* @param {Object} action
|
||||
*/
|
||||
#bindSetOCGState(link, action) {
|
||||
link.href = this.linkService.getAnchorUrl("");
|
||||
link.onclick = () => {
|
||||
this.linkService.executeSetOCGState(action);
|
||||
return false;
|
||||
};
|
||||
link.className = "internalLink";
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind JS actions to the link element.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue