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

XFA - Fix error when creating a new data node

- fix for issue #13556;
  - value in a field can be empty.
This commit is contained in:
Calixte Denizet 2021-06-14 11:33:03 +02:00
parent a4e8f3bdee
commit 150fa3d96e
4 changed files with 19 additions and 4 deletions

View file

@ -313,7 +313,7 @@ function createDataNode(root, container, expr) {
}
root = child;
} else {
parsed[i].index = children.length - index;
parsed[i].index = index - children.length;
return createNodes(root, parsed.slice(i));
}
}

View file

@ -2396,9 +2396,15 @@ class Field extends XFAObject {
if (this.ui.imageEdit) {
ui.children.push(this.value[$toHTML]().html);
} else if (!this.ui.button) {
const value = this.value.exData
? this.value.exData[$text]()
: this.value[$toHTML]().html.value;
let value = "";
if (this.value.exData) {
value = this.value.exData[$text]();
} else {
const htmlValue = this.value[$toHTML]().html;
if (htmlValue !== null) {
value = htmlValue.value;
}
}
if (value) {
if (ui.children[0].name === "textarea") {
ui.children[0].attributes.textContent = value;