mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[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:
parent
3f187c2c6d
commit
3f29892d63
12 changed files with 224 additions and 50 deletions
|
@ -271,7 +271,7 @@ class PDFScriptingManager {
|
|||
this._pdfViewer.isInPresentationMode ||
|
||||
this._pdfViewer.isChangingPresentationMode;
|
||||
|
||||
const { id, command, value } = detail;
|
||||
const { id, siblings, command, value } = detail;
|
||||
if (!id) {
|
||||
switch (command) {
|
||||
case "clear":
|
||||
|
@ -309,13 +309,17 @@ class PDFScriptingManager {
|
|||
}
|
||||
}
|
||||
|
||||
const element = document.getElementById(id);
|
||||
if (element) {
|
||||
element.dispatchEvent(new CustomEvent("updatefromsandbox", { detail }));
|
||||
} else {
|
||||
delete detail.id;
|
||||
// The element hasn't been rendered yet, use the AnnotationStorage.
|
||||
this._pdfDocument?.annotationStorage.setValue(id, detail);
|
||||
delete detail.id;
|
||||
|
||||
const ids = siblings ? [id, ...siblings] : [id];
|
||||
for (const elementId of ids) {
|
||||
const element = document.getElementById(elementId);
|
||||
if (element) {
|
||||
element.dispatchEvent(new CustomEvent("updatefromsandbox", { detail }));
|
||||
} else {
|
||||
// The element hasn't been rendered yet, use the AnnotationStorage.
|
||||
this._pdfDocument?.annotationStorage.setValue(elementId, detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue