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

+11 -3
View File
@@ -12,6 +12,7 @@
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\ExerciseGuide;
use App\Domain\Catalog\FormattedText;
use App\Domain\Catalog\ReleaseStatus;
use App\Domain\Catalog\StructureNode;
use App\Domain\Entitlement\DecideAccess;
@@ -125,7 +126,7 @@ public function index(User $user): array
'article' => $article,
'subject' => $subject,
'title' => $text['title'] ?? app(CourseOutline::class)->title($article),
'summary' => $text['summary'] ?? $element?->summary ?? $composition?->summary,
'summary' => $text['summary'] ?? FormattedText::plain($element?->summary ?? $composition?->summary) ?: null,
'kind' => app(CourseOutline::class)->kindLabel($article) ?? ($element === null ? null : $this->outputLabel($element->output_class)),
'coverage' => 'nutzbar',
'image' => $imageUrl === null ? null : ($element->thumbnail_alt ?: ($text['title'] ?? $element->working_title)),
@@ -170,6 +171,8 @@ public function program(User $user, Composition $composition): array
'title' => $text['title'],
'summary' => $text['summary'],
'description' => $text['description'],
'summary_html' => $text['summary_html'],
'description_html' => $text['description_html'],
'kind' => $composition->editorialContentKind?->label
?? ($composition->kind?->label()),
'is_module' => $composition->editorialContentKind?->slug === 'modul',
@@ -209,7 +212,7 @@ public function content(User $user, Composition $composition, int $elementVersio
$node = $found['node'];
$element = $node['element_id'] === null ? null : $this->element($node['element_id']);
$text = $element === null ? ['title' => $node['title'], 'summary' => null, 'description' => null] : $this->text($element);
$text = $element === null ? ['title' => $node['title'], 'summary' => null, 'description' => null, 'summary_html' => '', 'description_html' => ''] : $this->text($element);
$rootText = $this->text($composition);
$trail = [['label' => $rootText['title'], 'url' => route('member.program', $composition)]];
@@ -234,6 +237,8 @@ public function content(User $user, Composition $composition, int $elementVersio
'title' => $text['title'],
'summary' => $text['summary'],
'description' => $text['description'],
'summary_html' => $text['summary_html'],
'description_html' => $text['description_html'],
'trail' => $trail,
'back' => $trail[array_key_last($trail)],
'companions' => $companions,
@@ -245,7 +250,7 @@ public function content(User $user, Composition $composition, int $elementVersio
* Anzeigetitel und -texte für die Mitgliederbibliothek: Abweichung für „Mitgliederbibliothek“, sonst die zentrale Angabe,
* zuletzt die interne Bezeichnung. Nichts wird kopiert oder ergänzt.
*
* @return array{title: string, summary: ?string, description: ?string}
* @return array{title: string, summary: ?string, description: ?string, summary_html: string, description_html: string}
*/
public function text(Model $subject): array
{
@@ -261,6 +266,9 @@ public function text(Model $subject): array
'title' => $profile->value('display_title') ?? $profile->workingTitle ?? '',
'summary' => $profile->value('summary') ?? $profile->value('teaser'),
'description' => $profile->value('description'),
// Formatierte Fassung für Seiten, die sie zeigen; sonst gilt der Klartext oben.
'summary_html' => $profile->html('summary') ?: ($profile->value('teaser') !== null ? '<p>'.e($profile->value('teaser')).'</p>' : ''),
'description_html' => $profile->html('description'),
];
}