Fix: HTML-Tags in Nachrichten-Vorschau strippen
This commit is contained in:
parent
957c4a9707
commit
51c0fe58aa
2 changed files with 6 additions and 2 deletions
|
|
@ -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 @@
|
|||
</div>
|
||||
<span class="karte-meta">{gruppenLabel(n.gruppe_ids ?? [])}</span>
|
||||
{#if n.text}
|
||||
<p class="karte-vorschau">{n.text.slice(0, 120)}{n.text.length > 120 ? '…' : ''}</p>
|
||||
<p class="karte-vorschau">{stripHtml(n.text).slice(0, 120)}{stripHtml(n.text).length > 120 ? '…' : ''}</p>
|
||||
{/if}
|
||||
</li>
|
||||
{/each}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue