mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 08:38:06 +02:00
When changing a property on a radio button then change it for the siblings (bug 1922766)
This commit is contained in:
parent
689ffda9df
commit
86d1272d1b
5 changed files with 57 additions and 12 deletions
|
@ -587,6 +587,12 @@ class RadioButtonField extends Field {
|
|||
this._value = data.value || "";
|
||||
}
|
||||
|
||||
get _siblings() {
|
||||
return this._radioIds.filter(id => id !== this._id);
|
||||
}
|
||||
|
||||
set _siblings(_) {}
|
||||
|
||||
get value() {
|
||||
return this._value;
|
||||
}
|
||||
|
|
|
@ -96,27 +96,22 @@ function initSandbox(params) {
|
|||
obj.fieldPath = name;
|
||||
obj.appObjects = appObjects;
|
||||
|
||||
const otherFields = annotations.slice(1);
|
||||
|
||||
let field;
|
||||
switch (obj.type) {
|
||||
case "radiobutton": {
|
||||
const otherButtons = annotations.slice(1);
|
||||
field = new RadioButtonField(otherButtons, obj);
|
||||
field = new RadioButtonField(otherFields, obj);
|
||||
break;
|
||||
}
|
||||
case "checkbox": {
|
||||
const otherButtons = annotations.slice(1);
|
||||
field = new CheckboxField(otherButtons, obj);
|
||||
field = new CheckboxField(otherFields, obj);
|
||||
break;
|
||||
}
|
||||
case "text":
|
||||
if (annotations.length <= 1) {
|
||||
field = new Field(obj);
|
||||
break;
|
||||
}
|
||||
obj.siblings = annotations.map(x => x.id).slice(1);
|
||||
field = new Field(obj);
|
||||
break;
|
||||
default:
|
||||
if (otherFields.length > 0) {
|
||||
obj.siblings = otherFields.map(x => x.id);
|
||||
}
|
||||
field = new Field(obj);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue