Speichere formatierte Texte als bereinigtes HTML mit einem Editor (ADR-50)

Ein Baustein (FormattedText) bereinigt, bringt Werte in die kanonische Form und
wandelt Klartext des Altbestands; RichField ist der eine Editor, ManagesRichFields
verbindet ihn mit den Arbeitsplätzen. Formatiert sind Texte der Übungen und
Textbausteine, Kurzbeschreibung und Beschreibung, Lernziel und Ausstattung.
Mitgliederansicht und PDF zeigen fett, kursiv, Listen, Überschrift, Zitat und Link
(PDF: schräge Schnitte, nur wenn gebraucht). Das Livewire-Limit für verschachtelte
Pfade steigt auf 30, weil Aufzählungen sonst abgelehnt werden.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-23 23:45:54 +01:00
1 parent be24f3bf64
commit 9fbd933e1e
50 files changed
+1461 -181

No files matched your search

+79
View File
@@ -1014,6 +1014,37 @@ .mb-facts svg {
height: 1.1rem;
}
/* Angaben einer Übung (Lernziel, Dauer, Ausstattung): Bezeichnung und formatierter Text untereinander */
.mb-exercise .mb-facts {
display: grid;
align-items: start;
gap: var(--space-3);
margin-block: var(--space-4);
font-size: var(--text-body);
font-weight: 400;
}
.mb-exercise .mb-facts > div {
display: grid;
gap: var(--space-1);
}
.mb-exercise .mb-facts dt {
font-size: var(--text-small);
font-weight: 700;
}
.mb-exercise .mb-facts dd {
margin: 0;
}
@media (min-width: 40rem) {
.mb-exercise .mb-facts > div {
grid-template-columns: 9rem minmax(0, 1fr);
gap: var(--space-3);
}
}
.mb-note {
padding: var(--space-2) var(--space-3);
border-left: 4px solid currentColor;
@@ -1100,6 +1131,54 @@ .mb-prose > :last-child {
margin-bottom: 0;
}
/* Formatierte Texte (ADR-50): Absatz, Zwischenüberschrift, Listen, Zitat, Link */
.mb-prose p {
margin: 0 0 var(--space-3);
}
.mb-prose h3 {
margin: var(--space-4) 0 var(--space-2);
font-size: var(--text-body);
}
.mb-prose ul,
.mb-prose ol {
margin: 0 0 var(--space-3);
padding-left: 1.4rem;
}
.mb-prose ul {
list-style: disc;
}
.mb-prose ol {
list-style: decimal;
}
.mb-prose li {
display: list-item;
}
.mb-prose li > p {
margin: 0 0 var(--space-1);
}
.mb-prose a {
color: var(--lf-green-deep);
text-decoration: underline;
text-underline-offset: 0.15em;
}
.mb-prose blockquote {
margin: 0 0 var(--space-3);
padding-left: var(--space-3);
border-left: 3px solid var(--color-accent);
}
.mb-prose blockquote > p {
margin-bottom: var(--space-2);
}
.mb-reading {
max-width: var(--measure);
padding: var(--pad-card);
+1 -1
View File
@@ -27,6 +27,6 @@
@if (filled($version->body))
<article class="prose">
{!! nl2br(e($version->body)) !!}
{!! \App\Domain\Catalog\FormattedText::display($version->body) !!}
</article>
@endif
@@ -145,9 +145,10 @@
<label class="vw-feldlabel">Titel
<input id="text-titel" class="vw-eingabe" type="text" wire:model="newTextTitle" required autofocus>
</label>
<label class="vw-feldlabel">Inhalt
<textarea id="text-inhalt" class="vw-eingabe" rows="8" wire:model="newTextBody" required></textarea>
</label>
<div class="vw-feldlabel" role="group" aria-labelledby="text-inhalt-neu-label">
<span id="text-inhalt-neu-label">Inhalt</span>
<div class="vw-rich-eingabe">{{ $this->richKomponente('newTextBody') }}</div>
</div>
</div>
<div class="vw-dialog-fuss">
<div class="vw-dialog-fuss-zeile">
@@ -34,22 +34,22 @@
@endif
<h1>{{ $title }}</h1>
@if (filled($summary))
<p>{{ $summary }}</p>
<div>{!! \App\Domain\Catalog\FormattedText::display($summary) !!}</div>
@endif
@if (filled($description ?? null))
<h2>Beschreibung</h2>
<p>{{ $description }}</p>
<div>{!! \App\Domain\Catalog\FormattedText::display($description) !!}</div>
@endif
@if (filled($learningGoal))
<h2>Lernziel</h2>
<p>{{ $learningGoal }}</p>
<div>{!! \App\Domain\Catalog\FormattedText::display($learningGoal) !!}</div>
@endif
@if ($durationMinutes)
<p>Zeit: {{ $durationMinutes }} Minuten</p>
@endif
@if (filled($materialNote))
<h2>Material</h2>
<p>{{ $materialNote }}</p>
<div>{!! \App\Domain\Catalog\FormattedText::display($materialNote) !!}</div>
@endif
<h2>Aufbau</h2>
@include('filament.editorial.preview-nodes', ['nodes' => $nodes])
@@ -177,8 +177,8 @@
<div class="vw-detail-inhalt">
@if ($canEditBody)
<label class="vw-feldlabel" for="fassung-text">Text der Fassung</label>
<textarea id="fassung-text" class="vw-eingabe" rows="14" wire:model.live.blur="bodyDraft"></textarea>
<span class="vw-feldlabel" id="fassung-text-label">Text der Fassung</span>
<div id="fassung-text" class="vw-rich-eingabe">{{ $this->richKomponente('bodyDraft') }}</div>
<p class="vw-feld-hilfe">
@if ($bodyCommitted)
Fassung {{ $shown->number }} ist freigegeben und wird verwendet. Sie bleibt unverändert, „Text speichern“ legt Fassung {{ $naechste }} an.
@@ -8,9 +8,10 @@
<section class="vw-medien-haupt" aria-labelledby="didaktik-titel">
<h2 id="didaktik-titel" class="vw-abschnitt-titel">Didaktik</h2>
<p class="vw-feld-hilfe">Lernziel, Zeit und Material gehören zum fachlichen Stand {{ $ort }}. Sie werden mit „Entwurf speichern“ gesichert und erst mit „Fassung freigeben“ Teil einer neuen Fassung.</p>
<label class="vw-feldlabel">Lernziel
<textarea class="vw-eingabe" rows="4" wire:model.live.blur="learningGoal"></textarea>
</label>
<div class="vw-feldlabel" role="group" aria-labelledby="lernziel-label">
<span id="lernziel-label">Lernziel</span>
<div class="vw-rich-eingabe">{{ $this->richKomponente('learningGoal') }}</div>
</div>
<div class="vw-raster-2">
<label class="vw-feldlabel">Zeitbedarf in Minuten
<input class="vw-eingabe" type="text" inputmode="numeric" wire:model.live.blur="durationMinutes">
@@ -19,9 +20,10 @@
<input class="vw-eingabe" type="text" wire:model.live.blur="revisionNote">
</label>
</div>
<label class="vw-feldlabel">{{ $this->isExercise() ? 'Ausstattung' : 'Materialbedarf' }}
<textarea class="vw-eingabe" rows="3" wire:model.live.blur="materialNote"></textarea>
</label>
<div class="vw-feldlabel" role="group" aria-labelledby="material-label">
<span id="material-label">{{ $this->isExercise() ? 'Ausstattung' : 'Materialbedarf' }}</span>
<div class="vw-rich-eingabe">{{ $this->richKomponente('materialNote') }}</div>
</div>
@if ($this->isExercise())
<div class="vw-raster-2">
<label class="vw-feldlabel">Zeitbedarf bis (Minuten)
@@ -147,9 +147,10 @@
<label class="vw-feldlabel">Titel
<input class="vw-eingabe" type="text" wire:model="partTitle">
</label>
<label class="vw-feldlabel">Inhalt
<textarea class="vw-eingabe" rows="8" wire:model="partBody"></textarea>
</label>
<div class="vw-feldlabel" role="group" aria-labelledby="text-inhalt-label">
<span id="text-inhalt-label">Inhalt</span>
<div class="vw-rich-eingabe">{{ $this->richKomponente('partBody') }}</div>
</div>
<p class="vw-feld-hilfe">
@if (! empty($gewaehlt['committed']))
Diese Fassung ist freigegeben und wird verwendet. Speichern legt eine neue Fassung an; die bisherige bleibt in den freigegebenen Aufbauten.
@@ -167,6 +167,18 @@
.vw-feld-kopf .vw-feld-aktion { margin-left: auto; }
.vw-feld-wert { white-space: pre-line; overflow-wrap: anywhere; }
.vw-feld-wert.is-uebernommen { color: var(--vw-quiet); }
/* Formatierte Texte (ADR-50): Anzeige und Editor */
.vw-feld-wert.vw-rich { white-space: normal; }
.vw-rich p { margin: 0 0 0.5rem; }
.vw-rich h3 { margin: 0.75rem 0 0.35rem; font-size: 1rem; }
.vw-rich ul, .vw-rich ol { margin: 0 0 0.5rem; padding-left: 1.4rem; }
.vw-rich ul { list-style: disc; }
.vw-rich ol { list-style: decimal; }
.vw-rich li > p { margin: 0 0 0.2rem; }
.vw-rich blockquote { margin: 0 0 0.5rem; padding-left: 0.8rem; border-left: 3px solid var(--vw-line, #d5ddd6); }
.vw-rich > :last-child { margin-bottom: 0; }
.vw-rich-eingabe { display: block; margin-top: 0.3rem; font-weight: 400; }
.vw-rich-eingabe .fi-fo-rich-editor { min-width: 0; }
.vw-feld-wert.is-leer { color: var(--vw-muted); font-style: italic; }
.vw-feld-wert.is-kurz:not(.is-voll) { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vw-feld-edit { display: grid; gap: 0.45rem; }
@@ -6,8 +6,9 @@
$uebernommen = $wert === '' && $quelleWert !== '';
$geaendert = $this->feldGeaendert($feld);
$fehler = $this->redaktionFehlerFeld === $model;
$lang = mb_strlen($uebernommen ? $quelleWert : $wert) > 220;
$kind = $feld['kind'] ?? 'text';
$rich = $kind === 'rich';
$lang = mb_strlen($rich ? \App\Domain\Catalog\FormattedText::plain($uebernommen ? $quelleWert : $wert) : ($uebernommen ? $quelleWert : $wert)) > 220;
$id = 'feld-'.$feld['id'];
@endphp
<section @class(['vw-feld', 'is-fehler' => $fehler]) wire:key="feld-{{ $feld['id'] }}" x-data="{ offen: @js($fehler), voll: false }">
@@ -35,7 +36,11 @@
@if ($wert === '' && ! $uebernommen)
<p class="vw-feld-wert is-leer">Keine Angabe</p>
@else
<p @class(['vw-feld-wert', 'is-uebernommen' => $uebernommen, 'is-kurz' => $lang]) x-bind:class="{ 'is-voll': voll }">{{ $uebernommen ? $quelleWert : $wert }}</p>
@if ($rich)
<div @class(['vw-feld-wert', 'vw-rich', 'is-uebernommen' => $uebernommen, 'is-kurz' => $lang]) x-bind:class="{ 'is-voll': voll }">{!! \App\Domain\Catalog\FormattedText::html($uebernommen ? $quelleWert : $wert) !!}</div>
@else
<p @class(['vw-feld-wert', 'is-uebernommen' => $uebernommen, 'is-kurz' => $lang]) x-bind:class="{ 'is-voll': voll }">{{ $uebernommen ? $quelleWert : $wert }}</p>
@endif
@if ($lang)
<button type="button" class="vw-link is-quiet" x-on:click="voll = ! voll" x-text="voll ? 'Weniger anzeigen' : 'Ganzen Text anzeigen'">Ganzen Text anzeigen</button>
@endif
@@ -45,7 +50,9 @@
@if ($editable)
<div class="vw-feld-edit" id="{{ $id }}" x-show="offen" x-cloak>
<label class="vw-sr" for="{{ $id }}-eingabe">{{ $feld['label'] }}</label>
@if ($kind === 'textarea')
@if ($rich)
<div id="{{ $id }}-eingabe" x-ref="eingabe" class="vw-rich-eingabe" x-on:keydown.escape.stop="offen = false">{{ $this->richKomponente($model) }}</div>
@elseif ($kind === 'textarea')
<textarea id="{{ $id }}-eingabe" x-ref="eingabe" rows="{{ $feld['rows'] ?? 4 }}" wire:model.live.blur="{{ $model }}" placeholder="{{ $uebernommen || $wert === '' ? ($quelleWert !== '' ? $quelleWert : ($feld['placeholder'] ?? '')) : ($feld['placeholder'] ?? '') }}" @if ($fehler) aria-invalid="true" aria-describedby="{{ $id }}-fehler" @endif x-on:keydown.escape.stop="offen = false"></textarea>
@else
<input id="{{ $id }}-eingabe" x-ref="eingabe" type="text" wire:model.live.blur="{{ $model }}" placeholder="{{ $uebernommen || $wert === '' ? ($quelleWert !== '' ? $quelleWert : ($feld['placeholder'] ?? '')) : ($feld['placeholder'] ?? '') }}" @if ($fehler) aria-invalid="true" aria-describedby="{{ $id }}-fehler" @endif x-on:keydown.escape.stop="offen = false" x-on:keydown.enter.prevent="$el.blur(); offen = false">
+1 -1
View File
@@ -60,7 +60,7 @@
@endif
@if (filled($entry['version']->body))
<article class="mb-prose">
{!! nl2br(e($entry['version']->body)) !!}
{!! \App\Domain\Catalog\FormattedText::display($entry['version']->body) !!}
</article>
@endif
</li>
+5 -5
View File
@@ -78,14 +78,14 @@
</div>
<aside class="mb-content-side">
@if (filled($summary) || filled($description))
@if (filled($summary_html) || filled($description_html))
<section class="mb-side-card" aria-labelledby="kurz">
<h2 id="kurz">Kurzbeschreibung</h2>
@if (filled($summary))
<p>{{ $summary }}</p>
@if (filled($summary_html))
<div class="mb-prose">{!! $summary_html !!}</div>
@endif
@if (filled($description))
<div class="mb-prose">{!! nl2br(e($description)) !!}</div>
@if (filled($description_html))
<div class="mb-prose">{!! $description_html !!}</div>
@endif
</section>
@endif
+5 -5
View File
@@ -13,8 +13,8 @@
<article class="mb-reading mb-exercise">
<header class="mb-content-head">
<h1 class="mb-title">{{ $guide['title'] }}</h1>
@if (filled($guide['summary']))
<p class="mb-lead">{{ $guide['summary'] }}</p>
@if (filled($guide['summary_html']))
<div class="mb-lead mb-prose">{!! $guide['summary_html'] !!}</div>
@endif
</header>
@@ -24,7 +24,7 @@
<dl class="mb-facts">
@if (filled($guide['learning_goal']))
<div><dt>Lernziel</dt><dd>{{ $guide['learning_goal'] }}</dd></div>
<div><dt>Lernziel</dt><dd class="mb-prose">{!! \App\Domain\Catalog\FormattedText::display($guide['learning_goal']) !!}</dd></div>
@endif
@if ($guide['duration_minutes'] !== null)
<div><dt>Dauer</dt><dd>{{ $guide['duration_minutes'] }}@if ($guide['duration_max'] !== null) bis {{ $guide['duration_max'] }}@endif Minuten</dd></div>
@@ -33,7 +33,7 @@
<div><dt>Voraussetzungen</dt><dd>{{ $guide['prerequisites'] }}</dd></div>
@endif
@if (filled($guide['material_note']))
<div><dt>Ausstattung</dt><dd>{{ $guide['material_note'] }}</dd></div>
<div><dt>Ausstattung</dt><dd class="mb-prose">{!! \App\Domain\Catalog\FormattedText::display($guide['material_note']) !!}</dd></div>
@endif
</dl>
@@ -71,7 +71,7 @@
@if ($entry['allowed'] && $entry['class'] === 'text')
<h2>{{ $entry['title'] }}</h2>
<div class="mb-prose">
@include('member.partials.guide-blocks', ['blocks' => $entry['blocks']])
{!! $entry['html'] !!}
</div>
@elseif ($entry['allowed'])
<h2>{{ $entry['title'] }}</h2>
@@ -1,23 +0,0 @@
@foreach ($blocks as $block)
@switch ($block['type'])
@case ('heading')
<h3>{{ $block['text'] }}</h3>
@break
@case ('bullets')
<ul>
@foreach ($block['items'] as $item)
<li>{{ $item }}</li>
@endforeach
</ul>
@break
@case ('numbered')
<ol>
@foreach ($block['items'] as $item)
<li>{{ $item }}</li>
@endforeach
</ol>
@break
@default
<p>{{ $block['text'] }}</p>
@endswitch
@endforeach
+8 -8
View File
@@ -10,7 +10,7 @@
--}}
@section('content')
@php
$hasOverview = filled($description) || filled($learning_goal);
$hasOverview = filled($description_html) || filled($learning_goal);
$hasUse = filled($material_note);
$facts = [];
if ($module_count > 0) {
@@ -40,8 +40,8 @@
<div class="mb-detail-copy">
<x-member.type :type="$is_module ? 'modul' : 'programm'" :label="$kind" />
<h1 class="mb-title">{{ $title }} <x-brand.underline class="mb-title-line" /></h1>
@if (filled($summary))
<p class="mb-lede">{{ $summary }}</p>
@if (filled($summary_html))
<div class="mb-lede mb-prose">{!! $summary_html !!}</div>
@endif
<ul class="mb-facts">
@foreach ($facts as $fact)
@@ -69,17 +69,17 @@
@endif
@if ($hasOverview)
<section class="mb-section mb-overview {{ filled($description) && filled($learning_goal) ? '' : 'mb-overview-single' }}" id="ueberblick" aria-label="Überblick">
@if (filled($description))
<section class="mb-section mb-overview {{ filled($description_html) && filled($learning_goal) ? '' : 'mb-overview-single' }}" id="ueberblick" aria-label="Überblick">
@if (filled($description_html))
<div class="mb-overview-text">
<h2 id="ueberblick-titel">Darum geht es</h2>
<div class="mb-prose">{!! nl2br(e($description)) !!}</div>
<div class="mb-prose">{!! $description_html !!}</div>
</div>
@endif
@if (filled($learning_goal))
<aside class="mb-goal" aria-labelledby="lernziel-titel">
<h3 id="lernziel-titel"><x-heroicon-o-check-circle aria-hidden="true" /> Lernziele</h3>
<div class="mb-prose">{!! nl2br(e($learning_goal)) !!}</div>
<div class="mb-prose">{!! \App\Domain\Catalog\FormattedText::display($learning_goal) !!}</div>
</aside>
@endif
</section>
@@ -104,7 +104,7 @@
<h2 id="einsatz-titel">Einsatz &amp; Vorbereitung</h2>
<div class="mb-note-card">
<h3>Material</h3>
<div class="mb-prose">{!! nl2br(e($material_note)) !!}</div>
<div class="mb-prose">{!! \App\Domain\Catalog\FormattedText::display($material_note) !!}</div>
</div>
</section>
@endif
+1 -1
View File
@@ -14,7 +14,7 @@
<p class="state state-hinweis">Lizenzkennzeichnung: {{ $license }}</p>
@endif
<div class="mb-prose">
{!! nl2br(e($version->body)) !!}
{!! \App\Domain\Catalog\FormattedText::display($version->body) !!}
</div>
</article>
@endsection
+2 -2
View File
@@ -6,10 +6,10 @@
<p><a href="{{ route('public.programs') }}">Programme</a></p>
<h1>{{ $composition->display_title ?: $composition->designation }}</h1>
@if (filled($composition->summary))
<p class="lede">{{ $composition->summary }}</p>
<div class="lede">{!! \App\Domain\Catalog\FormattedText::display($composition->summary) !!}</div>
@endif
@if (filled($version->learning_goal))
<p>Lernziel: {{ $version->learning_goal }}</p>
<div><strong>Lernziel:</strong> {!! \App\Domain\Catalog\FormattedText::display($version->learning_goal) !!}</div>
@endif
<ol class="course">
@foreach ($nodes as $node)