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;

View File

@ -0,0 +1 @@
https://web.archive.org/web/20210422084343/https://mail.gnome.org/archives/evince-list/2013-November/pdfNC0hkVW67a.pdf

View File

@ -938,6 +938,14 @@
"enableXfa": true,
"type": "eq"
},
{ "id": "xfa_issue13556",
"file": "pdfs/xfa_issue13556.pdf",
"md5": "197e93a010763c3b6f9845595ee66c70",
"link": true,
"rounds": 1,
"enableXfa": true,
"type": "eq"
},
{ "id": "xfa_issue13213",
"file": "pdfs/xfa_issue13213.pdf",
"md5": "8a0e3179bffbac721589d1b1df863b49",