mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Don't reset all fields when the resetForm argument is an array
correctly set the readonly property in the annotation layer and set the default checkbox value to Off when none is provided.
This commit is contained in:
parent
08f26be7b4
commit
24b480fabe
6 changed files with 72 additions and 6 deletions
|
@ -3190,6 +3190,9 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
this._streams.push(this.uncheckedAppearance);
|
||||
}
|
||||
this._fallbackFontDict = this.fallbackFontDict;
|
||||
if (this.data.defaultFieldValue === null) {
|
||||
this.data.defaultFieldValue = "Off";
|
||||
}
|
||||
}
|
||||
|
||||
_processRadioButton(params) {
|
||||
|
@ -3238,6 +3241,9 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
this._streams.push(this.uncheckedAppearance);
|
||||
}
|
||||
this._fallbackFontDict = this.fallbackFontDict;
|
||||
if (this.data.defaultFieldValue === null) {
|
||||
this.data.defaultFieldValue = "Off";
|
||||
}
|
||||
}
|
||||
|
||||
_processPushButton(params) {
|
||||
|
|
|
@ -373,11 +373,7 @@ class AnnotationElement {
|
|||
event.target.title = event.detail.userName;
|
||||
},
|
||||
readonly: event => {
|
||||
if (event.detail.readonly) {
|
||||
event.target.setAttribute("readonly", "");
|
||||
} else {
|
||||
event.target.removeAttribute("readonly");
|
||||
}
|
||||
event.target.disabled = event.detail.readonly;
|
||||
},
|
||||
required: event => {
|
||||
this._setRequired(event.target, event.detail.required);
|
||||
|
|
|
@ -1185,7 +1185,7 @@ class Doc extends PDFObject {
|
|||
|
||||
resetForm(aFields = null) {
|
||||
// Handle the case resetForm({ aFields: ... })
|
||||
if (aFields && typeof aFields === "object") {
|
||||
if (aFields && typeof aFields === "object" && !Array.isArray(aFields)) {
|
||||
aFields = aFields.aFields;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue