[JS] Fix several issues found in pdf in #13269

- app.alert and few other function can use an object as parameter ({cMsg: ...});
  - support app.alert with a question and a yes/no answer;
  - update field siblings when one is changed in an action;
  - stop calculation if calculate is set to false in the middle of calculations;
  - get a boolean for checkboxes when they've been set through annotationStorage instead of a string.
This commit is contained in:
Calixte Denizet 2021-04-20 19:21:52 +02:00
parent 3f187c2c6d
commit 3f29892d63
12 changed files with 224 additions and 50 deletions

View file

@ -38,6 +38,14 @@ class ProxyHandler {
}
set(obj, prop, value) {
if (obj._kidIds) {
// If the field is a container for other fields then
// dispatch the kids.
obj._kidIds.forEach(id => {
obj._appObjects[id].wrapped[prop] = value;
});
}
if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {
const old = obj[prop];
obj[prop] = value;
@ -46,7 +54,12 @@ class ProxyHandler {
data[prop] = obj[prop];
// send the updated value to the other side
obj._send(data);
if (!obj._siblings) {
obj._send(data);
} else {
data.siblings = obj._siblings;
obj._send(data);
}
}
} else {
obj._expandos[prop] = value;