Fix the rendering of XFA rich text in popup annotations

Before the introduction of the `renderRichText` helper function we
exclusively used `this.#html` for XFA rich text and exclusively used
`this.#contentsObj` for plain text. However, after the refactoring we
tried to access `this.#contentsObj.dir` in both cases, which fails for
XFA rich text because `this.#contentsObj` is `null` in that case.

This commit fixes the issue by using optional chaining to make sure we
don't try to access non-existent `this.#contentsObj` properties, which
makes the `must update an existing annotation and show the right popup`
freetext integration pass again.

Fixes #20237.
Fixes 35c90984.
This commit is contained in:
Tim van der Meij 2025-09-07 18:35:17 +02:00
parent 2a93ade197
commit f1f8ee47ff
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -2494,7 +2494,7 @@ class PopupElement {
renderRichText(
{
html: this.#html || this.#contentsObj.str,
dir: this.#contentsObj.dir,
dir: this.#contentsObj?.dir,
className: "popupContent",
},
popup