Flatten a multi-line address in the cover-letter footer

doc.text breaks on newlines, which stacked the street above the city in
the footer contact strip. Split the address on newlines and commas and
rejoin as one line.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 12:39:36 +02:00
co-authored by Claude Opus 4.8
parent 8281128adc
commit fa25307791
+6 -1
View File
@@ -1073,7 +1073,12 @@ function composeLetter(doc, S, dry, cur, { letter, header, job, anlagen, signatu
// the reserved bottom margin so it never collides with the body. ---
if (!dry) {
const parts = [];
if (header.adresse) parts.push(String(header.adresse).replace(/\s*,\s*/g, ', '));
// Flatten a possibly multi-line address (newlines and/or commas) to one
// line — doc.text breaks on \n, which would stack the street above the city.
if (header.adresse) {
const adr = String(header.adresse).split(/[\n,]/).map((s) => s.trim()).filter(Boolean).join(', ');
if (adr) parts.push(adr);
}
if (header.telefon) parts.push(header.telefon);
if (header.email) parts.push(header.email);
if (parts.length) {