mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 08:38:06 +02:00
Use the V entry as an option when no options in a choice widget
It fixes #19083. It isn't really a fix but more a workaround (we should correctly implement the choice widget as a mix of text input+select).
This commit is contained in:
parent
07765e993e
commit
b0b0de98e7
4 changed files with 22 additions and 0 deletions
|
@ -3511,6 +3511,18 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
|
|||
}
|
||||
}
|
||||
|
||||
// It's a workaround for the issue #19083.
|
||||
// Normally a choice widget is a mix of a text field and a listbox,
|
||||
// So in the case where the V entry isn't an option we should just set it
|
||||
// as the text field value.
|
||||
if (this.data.options.length === 0 && this.data.fieldValue.length > 0) {
|
||||
// If there are no options, then the field value is the only option.
|
||||
this.data.options = this.data.fieldValue.map(value => ({
|
||||
exportValue: value,
|
||||
displayValue: value,
|
||||
}));
|
||||
}
|
||||
|
||||
// Process field flags for the display layer.
|
||||
this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
|
||||
this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue