Improve iframe document CSS: serif font, normalize bold

- Switch to Georgia to better match Word's serif rendering
- Explicit font-weight:normal on body/p so mammoth's <strong> wrapping
  doesn't bleed into paragraph text
- Tighter heading/paragraph spacing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-07-30 11:40:38 -04:00
1 parent fe29d25ddb
commit 6c9cfa84a8
1 file changed
+13 -3
+13 -3
View File
@@ -1554,9 +1554,19 @@ app.post('/api/admin/upload-attachment', requirePin, async (req, res) => {
const { value: bodyHtml } = await mammoth.convertToHtml({ buffer }); const { value: bodyHtml } = await mammoth.convertToHtml({ buffer });
const htmlFilename = `${uuid}.html`; const htmlFilename = `${uuid}.html`;
const page = `<!doctype html><html><head><meta charset="utf-8"> const page = `<!doctype html><html><head><meta charset="utf-8">
<style>*{box-sizing:border-box}body{font-family:sans-serif;margin:0;padding:1rem;line-height:1.6;font-size:15px} <style>
img{max-width:100%}table{border-collapse:collapse;width:100%}td,th{border:1px solid #ccc;padding:.4em .6em} *{box-sizing:border-box}
h1,h2,h3{margin-top:1em}</style> body{font-family:Georgia,serif;margin:0;padding:1rem 1.5rem;line-height:1.7;font-size:15px;font-weight:normal;color:#111}
p{margin:.6em 0;font-weight:normal}
strong,b{font-weight:bold}
h1{font-size:1.5em;margin:1em 0 .3em}
h2{font-size:1.25em;margin:.9em 0 .3em}
h3{font-size:1.1em;margin:.8em 0 .2em}
img{max-width:100%}
table{border-collapse:collapse;width:100%}
td,th{border:1px solid #ccc;padding:.4em .6em}
ul,ol{padding-left:1.5em}
</style>
</head><body>${bodyHtml}</body></html>`; </head><body>${bodyHtml}</body></html>`;
await writeFile(join(ATTACHMENTS_DIR, htmlFilename), page); await writeFile(join(ATTACHMENTS_DIR, htmlFilename), page);
htmlUrl = `/api/attachments/${htmlFilename}`; htmlUrl = `/api/attachments/${htmlFilename}`;