fix(richtext): blank lines survive into PDFs and read-only previews
Quill 2's semantic HTML saves a blank line as a truly empty <p></p> (no <br> placeholder) — verified in the DB (invoice_sections hold <p></p>, zero <p><br>) — which collapses to nothing outside the editor. cleanQuillHtml (PDF path) and the new restoreQuillBlankLines (order/ invoice read-only previews) restore the placeholder at render time, so existing stored content is covered retroactively. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,10 @@ export function cleanQuillHtml(html: string | null | undefined): string {
|
||||
);
|
||||
// Replace with regular space (outside of tags)
|
||||
s = s.replace(/( )/g, " ");
|
||||
// Quill 2's semantic HTML saves blank lines as truly empty <p></p>, which
|
||||
// collapse to zero height in the PDF — restore the <br> placeholder so an
|
||||
// editor blank line stays a blank line.
|
||||
s = s.replace(/<p([^>]*)>\s*<\/p>/gi, "<p$1><br></p>");
|
||||
// Inline styles: Quill writes text/background colors as style attributes.
|
||||
// Keep ONLY color/background-color with literal color values — everything
|
||||
// else (url(), expression(), positioning…) must never reach Puppeteer.
|
||||
|
||||
Reference in New Issue
Block a user