CMS: Absatz-Tags aus dem Rich-Text-Editor erscheinen nicht mehr als Text

Der Editor packt eingefügten Text in <p>; Felder wie die FAQ-Antwort gibt die Website als Text
aus, die Tags waren sichtbar. Beim Speichern entfernt unwrapParagraphs() die Absätze (ein
Absatz ohne <p>, mehrere mit <br><br>, Blockinhalte unverändert). cms_inline() gibt die
Felder als bereinigtes Inline-HTML aus – auch schon gespeicherte Texte mit <p> erscheinen
sauber, Fett und Hervorhebung werden dargestellt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-10-12 06:58:48 +00:00
parent 07816dce19
commit 451e738c8b
20 changed files with 147 additions and 23 deletions

View file

@ -406,7 +406,7 @@ $saveEdit = function () {
$valueToSave = $this->editValue;
if ($this->editingFieldType === 'html') {
$valueToSave = CmsFluxEditorHtmlTransformer::fromEditor($valueToSave);
$valueToSave = CmsFluxEditorHtmlTransformer::unwrapParagraphs(CmsFluxEditorHtmlTransformer::fromEditor($valueToSave));
}
if ($this->editingField !== null) {

View file

@ -86,19 +86,19 @@
@if ($item['lead'] !== '')
<strong class="font-medium text-foreground">{{ $item['lead'] }}:</strong>
@endif
{{ $item['text'] }}
{!! cms_inline($item['text'] ?? '') !!}
</span>
</li>
@endforeach
</ul>
@else
<p class="text-muted-foreground leading-relaxed mt-4">{{ $block['text'] }}</p>
<p class="text-muted-foreground leading-relaxed mt-4">{!! cms_inline($block['text'] ?? '') !!}</p>
@endif
@endforeach
@if (!empty($section['quote']))
<figure class="mt-8 border-l-4 border-secondary pl-6">
<blockquote class="text-large leading-relaxed italic">„{{ $section['quote'] }}"</blockquote>
<blockquote class="text-large leading-relaxed italic">„{!! cms_inline($section['quote'] ?? '') !!}"</blockquote>
@if (!empty($section['quote_author']))
<figcaption class="text-sm text-muted-foreground mt-3">{{ $section['quote_author'] }}</figcaption>
@endif
@ -169,7 +169,7 @@
@foreach ($brand['services'] as $index => $service)
<div class="card-elevated rounded-2xl p-6" wire:key="service-{{ $index }}">
<h3 class="text-lg font-medium">{{ $service['title'] ?? '' }}</h3>
<p class="text-muted-foreground leading-relaxed mt-2">{{ $service['description'] ?? '' }}</p>
<p class="text-muted-foreground leading-relaxed mt-2">{!! cms_inline($service['description'] ?? '') !!}</p>
</div>
@endforeach
</div>

View file

@ -28,7 +28,7 @@
<h3 class="text-xl font-medium">{{ $world['title'] }}</h3>
@endif
<p class="text-muted-foreground leading-relaxed mt-2">
{{ $world['description'] }}
{!! cms_inline($world['description'] ?? '') !!}
</p>
</div>

View file

@ -24,7 +24,7 @@
x-on:keydown.escape.window="open && hide()">
<div>
<h2 class="text-section-title">{!! $content['title'] ?? '' !!}</h2>
<p class="text-large text-muted-foreground leading-relaxed mt-6">{{ $content['text'] ?? '' }}</p>
<p class="text-large text-muted-foreground leading-relaxed mt-6">{!! cms_inline($content['text'] ?? '') !!}</p>
@if (!empty($content['note']))
<p class="text-sm text-muted-foreground mt-4">{{ $content['note'] }}</p>

View file

@ -65,7 +65,7 @@
<div class="px-6 pb-6">
<div class="border-t border-border pt-4">
<p class="text-muted-foreground leading-relaxed">
{{ $faq['answer'] }}
{!! cms_inline($faq['answer'] ?? '') !!}
</p>
</div>
</div>

View file

@ -9,7 +9,7 @@
<div class="absolute inset-0 flex items-end justify-center pb-12 px-6">
<div class="text-center slide-up delay-300">
<p class="text-xl lg:text-2xl font-medium text-white italic max-w-2xl leading-relaxed">
"{{ $content['quote'] }}"
"{!! cms_inline($content['quote'] ?? '') !!}"
</p>
@if (isset($content['author']))
<p class="text-sm text-white/70 mt-3">– {{ $content['author'] }}</p>

View file

@ -4,7 +4,7 @@
<div class="container-narrow">
<div class="border-t border-border pt-10 text-center">
<h2 class="text-xl font-medium">{!! $content['title'] ?? '' !!}</h2>
<p class="text-muted-foreground leading-relaxed mt-3 max-w-2xl mx-auto">{{ $content['text'] ?? '' }}</p>
<p class="text-muted-foreground leading-relaxed mt-3 max-w-2xl mx-auto">{!! cms_inline($content['text'] ?? '') !!}</p>
@if (!empty($content['link_text']))
<a href="{{ $content['link_url'] ?? '/immobilien' }}"

View file

@ -1,7 +1,7 @@
<section id="marken-cta" class="section-padding bg-secondary text-secondary-foreground">
<div class="container-narrow text-center spacing-section">
<h2 class="text-section-title text-white">{!! $content['title'] ?? '' !!}</h2>
<p class="text-large max-w-2xl mx-auto leading-relaxed">{{ $content['text'] ?? '' }}</p>
<p class="text-large max-w-2xl mx-auto leading-relaxed">{!! cms_inline($content['text'] ?? '') !!}</p>
<div class="pt-4 flex flex-wrap items-center justify-center gap-4">
<x-appointment-link :href="$content['button_link'] ?? '/contact'" class="btn-primary-accent px-8 py-4 text-lg">

View file

@ -3,7 +3,7 @@
<section id="wachstum" class="py-16 {{ $bg }}">
<div class="container-narrow text-center">
<h2 class="text-2xl font-medium">{!! $content['title'] ?? '' !!}</h2>
<p class="text-muted-foreground leading-relaxed mt-4">{{ $content['text'] ?? '' }}</p>
<p class="text-muted-foreground leading-relaxed mt-4">{!! cms_inline($content['text'] ?? '') !!}</p>
</div>
</section>
@endif

View file

@ -37,7 +37,7 @@
{!! renderHeroIcon($point['icon'] ?? 'user', 'outline', 'text-secondary-foreground') !!}
</div>
<h3 class="text-lg font-medium">{{ $point['title'] ?? '' }}</h3>
<p class="text-muted-foreground leading-relaxed mt-2">{{ $point['description'] ?? '' }}</p>
<p class="text-muted-foreground leading-relaxed mt-2">{!! cms_inline($point['description'] ?? '') !!}</p>
</div>
@endforeach
</div>

View file

@ -119,7 +119,7 @@
<div>
<h4 class="font-medium mb-1">{{ $step['title'] }}</h4>
@if (!empty($step['description']))
<p class="text-sm text-muted-foreground leading-relaxed">{{ $step['description'] }}</p>
<p class="text-sm text-muted-foreground leading-relaxed">{!! cms_inline($step['description'] ?? '') !!}</p>
@endif
</div>
</li>

View file

@ -32,7 +32,7 @@
@endif
@if(isset($card['description']))
<p class="text-muted-foreground leading-relaxed mt-4 text-center">
{{ $card['description'] }}
{!! cms_inline($card['description'] ?? '') !!}
</p>
@endif
</div>

View file

@ -53,7 +53,7 @@ function renderHeroIcon($iconName, $style = 'outline') {
@endif
@if(isset($value['description']))
<p class="text-muted-foreground leading-relaxed mt-2 text-center">
{{ $value['description'] }}
{!! cms_inline($value['description'] ?? '') !!}
</p>
@endif
</div>

View file

@ -8,7 +8,7 @@
<div class="lg:col-span-3 slide-right delay-200">
<x-web.hero-eyebrow :text="$content['eyebrow'] ?? null" class="mb-6" />
<h1 class="text-hero-alt">{!! $content['title'] ?? '' !!}</h1>
<p class="text-large text-muted-foreground leading-relaxed mt-6">{{ $content['text'] ?? '' }}</p>
<p class="text-large text-muted-foreground leading-relaxed mt-6">{!! cms_inline($content['text'] ?? '') !!}</p>
<x-web.hero-trust :items="$content['stats'] ?? []" class="mt-8" />
</div>
@ -23,7 +23,7 @@
<div class="max-w-3xl slide-right delay-200">
<x-web.hero-eyebrow :text="$content['eyebrow'] ?? null" class="mb-6" />
<h1 class="text-hero-alt">{!! $content['title'] ?? '' !!}</h1>
<p class="text-large text-muted-foreground leading-relaxed mt-6">{{ $content['text'] ?? '' }}</p>
<p class="text-large text-muted-foreground leading-relaxed mt-6">{!! cms_inline($content['text'] ?? '') !!}</p>
<x-web.hero-trust :items="$content['stats'] ?? []" class="mt-8" />
</div>
@endif

View file

@ -3,7 +3,7 @@
<div class="text-center max-w-2xl mx-auto">
<h2 class="text-section-title">{!! $content['title'] ?? '' !!}</h2>
@if (!empty($content['text']))
<p class="text-large text-muted-foreground leading-relaxed mt-4">{{ $content['text'] }}</p>
<p class="text-large text-muted-foreground leading-relaxed mt-4">{!! cms_inline($content['text'] ?? '') !!}</p>
@endif
</div>
@ -27,7 +27,7 @@
<p class="text-xs uppercase tracking-wider text-clay mt-1">{{ $project['meta'] }}</p>
@endif
@if (!empty($project['description']))
<p class="text-sm text-muted-foreground leading-relaxed mt-2">{{ $project['description'] }}</p>
<p class="text-sm text-muted-foreground leading-relaxed mt-2">{!! cms_inline($project['description'] ?? '') !!}</p>
@endif
@if (!empty($project['gallery']))
{{-- Weitere Bilder der Referenz als kleine Reihe --}}

View file

@ -33,7 +33,7 @@
@endif
</h3>
@if (!empty($logo['text']))
<p class="text-sm text-muted-foreground leading-relaxed mt-2">{{ $logo['text'] }}</p>
<p class="text-sm text-muted-foreground leading-relaxed mt-2">{!! cms_inline($logo['text'] ?? '') !!}</p>
@endif
</div>
</{{ $url ? 'a' : 'div' }}>

View file

@ -23,7 +23,7 @@
@endif
<span class="font-medium text-center leading-snug">
{{ $content['text'] ?? '' }}
{!! cms_inline($content['text'] ?? '') !!}
</span>
@if (isset($content['link_text']) && isset($content['link_url']))