Merge pull request #15377 from Snuffleupagus/SetOCGState

[api-minor] Add basic support for the `SetOCGState` action (issue 15372)
This commit is contained in:
Tim van der Meij 2022-09-03 13:26:06 +02:00 committed by GitHub
commit 50d72fc111
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 185 additions and 31 deletions

View file

@ -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.
*