Skip to content

Commit

Permalink
stephanrauh/ngx-extended-pdf-viewer#1516 fix broken two-way binding o…
Browse files Browse the repository at this point in the history
…f forms
  • Loading branch information
stephanrauh committed Sep 8, 2022
1 parent 7ca4c3a commit 650c538
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,21 @@ class AnnotationElement {
display: event => {
const hidden = event.detail.display % 2 === 1;
this.container.style.visibility = hidden ? "hidden" : "visible";
this.annotationStorage.setValue(this.data.id, {
this.annotationStorage.setValue(this.data.id, this.data.fieldName, { // #718 modified by ngx-extended-pdf-viewer
hidden,
print: event.detail.display === 0 || event.detail.display === 3,
});
},
print: event => {
this.annotationStorage.setValue(this.data.id, {
this.annotationStorage.setValue(this.data.id, this.data.fieldName, { // #718 modified by ngx-extended-pdf-viewer
print: event.detail.print,
});
},
hidden: event => {
this.container.style.visibility = event.detail.hidden
? "hidden"
: "visible";
this.annotationStorage.setValue(this.data.id, {
this.annotationStorage.setValue(this.data.id, this.data.fieldName, {
hidden: event.detail.hidden,
});
},
Expand Down Expand Up @@ -369,7 +369,7 @@ class AnnotationElement {
rotation: event => {
const angle = event.detail.rotation;
this.setRotation(angle);
this.annotationStorage.setValue(this.data.id, {
this.annotationStorage.setValue(this.data.id, this.data.fieldName, { // #718 modified by ngx-extended-pdf-viewer
rotation: angle,
});
},
Expand Down Expand Up @@ -788,19 +788,19 @@ class LinkAnnotationElement extends AnnotationElement {
switch (field.type) {
case "text": {
const value = field.defaultValue || "";
storage.setValue(id, { value });
storage.setValue(id, this.data.fieldName, { value }); // #718 modified by ngx-extended-pdf-viewer
break;
}
case "checkbox":
case "radiobutton": {
const value = field.defaultValue === field.exportValues;
storage.setValue(id, { value });
storage.setValue(id, this.data.fieldName, { value }); // #718 modified by ngx-extended-pdf-viewer
break;
}
case "combobox":
case "listbox": {
const value = field.defaultValue || "";
storage.setValue(id, { value });
storage.setValue(id, this.data.fieldName, { value }); // #718 modified by ngx-extended-pdf-viewer
break;
}
default:
Expand Down Expand Up @@ -1137,7 +1137,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
}
value = value.slice(0, charLimit);
target.value = elementData.userValue = value;
storage.setValue(id, { value });
storage.setValue(id, this.data.fieldName, { value });

this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
source: this,
Expand Down

0 comments on commit 650c538

Please sign in to comment.