Merge pull request #13807 from calixteman/fulltext

XFA - Get the full value when binding and not only the 1st line (bug 1718725)
This commit is contained in:
calixteman 2021-07-27 22:22:37 +02:00 committed by GitHub
commit 45f3804737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2753,6 +2753,8 @@ class Field extends XFAObject {
let value = "";
if (this.value.exData) {
value = this.value.exData[$text]();
} else if (this.value.text) {
value = this.value.text[$getExtra]();
} else {
const htmlValue = this.value[$toHTML]().html;
if (htmlValue !== null) {
@ -5418,6 +5420,27 @@ class Text extends ContentObject {
super[$onText](str);
}
[$finalize]() {
if (typeof this[$content] === "string") {
this[$content] = this[$content].replace(/\r\n/g, "\n");
}
}
[$getExtra]() {
if (typeof this[$content] === "string") {
return this[$content]
.split(/[\u2029\u2028\n]/)
.reduce((acc, line) => {
if (line) {
acc.push(line);
}
return acc;
}, [])
.join("\n");
}
return this[$content][$text]();
}
[$toHTML](availableSpace) {
if (typeof this[$content] === "string") {
// \u2028 is a line separator.