1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #12568 from calixteman/defaultvalue

[api-minor] JS -- Add default value in annotation data
This commit is contained in:
Tim van der Meij 2020-11-05 22:53:21 +01:00 committed by GitHub
commit 646f895d35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -951,6 +951,13 @@ class WidgetAnnotation extends Annotation {
});
data.fieldValue = this._decodeFormValue(fieldValue);
const defaultFieldValue = getInheritableProperty({
dict,
key: "DV",
getArray: true,
});
data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
data.alternativeText = stringToPDFString(dict.get("TU") || "");
data.defaultAppearance =
getInheritableProperty({ dict, key: "DA" }) ||
@ -1652,6 +1659,7 @@ class TextWidgetAnnotation extends WidgetAnnotation {
return {
id: this.data.id,
value: this.data.fieldValue,
defaultValue: this.data.defaultFieldValue,
multiline: this.data.multiLine,
password: this.hasFieldFlag(AnnotationFieldFlag.PASSWORD),
charLimit: this.data.maxLen,
@ -1976,6 +1984,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
return {
id: this.data.id,
value,
defaultValue: this.data.defaultFieldValue,
editable: !this.data.readOnly,
name: this.data.fieldName,
rect: this.data.rect,
@ -2052,6 +2061,7 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
return {
id: this.data.id,
value,
defaultValue: this.data.defaultFieldValue,
editable: !this.data.readOnly,
name: this.data.fieldName,
rect: this.data.rect,