1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

JS -- Add listener for sandbox events only if there are some actions

* When no actions then set it to null instead of empty object
* Even if a field has no actions, it needs to listen to events from the sandbox in order to be updated if an action changes something in it.
This commit is contained in:
Calixte Denizet 2020-10-28 19:16:56 +01:00
parent 55f55f5859
commit a5279897a7
13 changed files with 170 additions and 28 deletions

View file

@ -1020,6 +1020,21 @@ class PDFDocument {
);
}
get hasJSActions() {
return shadow(
this,
"hasJSActions",
this.fieldObjects.then(fieldObjects => {
return (
fieldObjects !== null &&
Object.values(fieldObjects).some(fieldObject =>
fieldObject.some(object => object.actions !== null)
)
);
})
);
}
get calculationOrderIds() {
const acroForm = this.catalog.acroForm;
if (!acroForm || !acroForm.has("CO")) {