diff --git a/app/src/routes/(app)/nachrichten/+page.svelte b/app/src/routes/(app)/nachrichten/+page.svelte index 2dd2d55..b04a42b 100644 --- a/app/src/routes/(app)/nachrichten/+page.svelte +++ b/app/src/routes/(app)/nachrichten/+page.svelte @@ -26,6 +26,10 @@ loading = false; }); + function stripHtml(html: string): string { + return html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim(); + } + function toggleGruppe(id: string) { fGruppeIds = fGruppeIds.includes(id) ? fGruppeIds.filter((g) => g !== id) @@ -116,7 +120,7 @@ {gruppenLabel(n.gruppe_ids ?? [])} {#if n.text} -

{n.text.slice(0, 120)}{n.text.length > 120 ? '…' : ''}

+

{stripHtml(n.text).slice(0, 120)}{stripHtml(n.text).length > 120 ? '…' : ''}

{/if} {/each} diff --git a/scripts/seed.js b/scripts/seed.js index 42bb7ed..b3d4ac7 100644 --- a/scripts/seed.js +++ b/scripts/seed.js @@ -137,7 +137,7 @@ async function main() { console.log('→ Nachricht...'); await req('POST', '/nachrichten', { betreff: 'Willkommen in vereins.haus!', - text: '

Hallo und herzlich willkommen! Dies ist eine Beispiel-Nachricht an alle Mitglieder.

', + text: 'Hallo und herzlich willkommen! Dies ist eine Beispiel-Nachricht an alle Mitglieder.', gruppe_ids: [], }, T); console.log(` ✓ Nachricht erstellt`);