mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #12836 from calixteman/update_buttons
JS -- update radio/checkbox values even if there are no actions
This commit is contained in:
commit
2cba290361
5 changed files with 65 additions and 35 deletions
|
@ -2007,7 +2007,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
}
|
||||
return {
|
||||
id: this.data.id,
|
||||
value: this.data.fieldValue || null,
|
||||
value: this.data.fieldValue || "Off",
|
||||
defaultValue: this.data.defaultFieldValue,
|
||||
exportValues,
|
||||
editable: !this.data.readOnly,
|
||||
|
|
|
@ -544,9 +544,6 @@ class WidgetAnnotationElement extends AnnotationElement {
|
|||
}
|
||||
|
||||
_setEventListener(element, baseName, eventName, valueGetter) {
|
||||
if (this.data.actions[eventName.replace(" ", "")] === undefined) {
|
||||
return;
|
||||
}
|
||||
if (baseName.includes("mouse")) {
|
||||
// Mouse events
|
||||
element.addEventListener(baseName, event => {
|
||||
|
@ -577,11 +574,14 @@ class WidgetAnnotationElement extends AnnotationElement {
|
|||
}
|
||||
|
||||
_setEventListeners(element, names, getter) {
|
||||
if (!this.data.actions) {
|
||||
return;
|
||||
}
|
||||
for (const [baseName, eventName] of names) {
|
||||
this._setEventListener(element, baseName, eventName, getter);
|
||||
if (
|
||||
eventName === "Action" ||
|
||||
(this.data.actions &&
|
||||
this.data.actions[eventName.replace(" ", "")] !== undefined)
|
||||
) {
|
||||
this._setEventListener(element, baseName, eventName, getter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue