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:
1 parent
be24f3bf64
commit
9fbd933e1e
50 files changed
+1461
-181
No files matched your search
@@ -8,6 +8,7 @@
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Catalog\EditorialVocabulary;
|
||||
use App\Domain\Catalog\FormattedText;
|
||||
use App\Domain\Catalog\IdentityChange;
|
||||
use App\Domain\Catalog\IdentityDimension;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
@@ -26,6 +27,7 @@
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use App\Filament\Support\ElementRevision;
|
||||
use App\Filament\Support\ManagesEditorialSurface;
|
||||
use App\Filament\Support\ManagesRichFields;
|
||||
use App\Filament\Support\MediaLibrary;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use App\Http\Controllers\ContentPreviewController;
|
||||
@@ -45,6 +47,7 @@
|
||||
class ViewContentElement extends ViewRecord
|
||||
{
|
||||
use ManagesEditorialSurface;
|
||||
use ManagesRichFields;
|
||||
use ReportsDomainRules;
|
||||
use WithFileUploads;
|
||||
|
||||
@@ -211,7 +214,7 @@ public function textUnsaved(): bool
|
||||
return $shown instanceof ContentElementVersion
|
||||
&& $this->getRecord()->output_class === 'text'
|
||||
&& $shown->status !== ContentVersionStatus::Gesperrt
|
||||
&& trim($this->bodyDraft) !== trim((string) $shown->body);
|
||||
&& ! FormattedText::same($this->bodyDraft, $shown->body);
|
||||
}
|
||||
|
||||
public function discardShownText(): void
|
||||
@@ -243,7 +246,7 @@ public function saveShownText(): void
|
||||
}
|
||||
|
||||
try {
|
||||
$saved = app(ContentService::class)->reviseElementContent($shown, $this->bodyDraft);
|
||||
$saved = app(ContentService::class)->reviseElementContent($shown, FormattedText::canonical($this->bodyDraft));
|
||||
} catch (DomainRuleException $exception) {
|
||||
$this->fassungFeedback = $exception->getMessage();
|
||||
$this->fassungFeedbackError = true;
|
||||
@@ -687,9 +690,9 @@ protected function saveRedaktionTexte(): bool
|
||||
'working_title' => $title,
|
||||
'display_title' => $this->displayTitle,
|
||||
'teaser' => $this->teaser,
|
||||
'summary' => $this->summary,
|
||||
'summary' => $this->richStore('summary', $element->summary),
|
||||
'search_terms' => $this->searchTerms,
|
||||
'description' => $this->descriptionText,
|
||||
'description' => $this->richStore('descriptionText', $element->description),
|
||||
'usage_note' => $this->usageNote,
|
||||
'license_note' => $this->licenseNote,
|
||||
'website_credit' => $this->websiteCredit,
|
||||
@@ -780,6 +783,14 @@ public function redaktionTitel(): string
|
||||
return $title !== '' ? $title : (string) $this->getRecord()->working_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
protected function richFelder(): array
|
||||
{
|
||||
return ['summary', 'descriptionText', 'bodyDraft'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
@@ -793,8 +804,8 @@ public function redaktionFelder(): array
|
||||
['id' => 'arbeitstitel', 'label' => 'Arbeitstitel', 'model' => 'workingTitle', 'kind' => 'text', 'stored' => $stored('working_title'), 'required' => true, 'hilfe' => 'Bezeichnung in der Verwaltung. Pflichtangabe.'],
|
||||
['id' => 'anzeigename', 'label' => 'Anzeigename', 'model' => 'displayTitle', 'kind' => 'text', 'stored' => $stored('display_title'), 'hilfe' => 'Erscheint auf Karten und in der Bibliothek. Leer zeigt den Arbeitstitel.'],
|
||||
['id' => 'teaser', 'label' => 'Teaser', 'model' => 'teaser', 'kind' => 'textarea', 'rows' => 2, 'stored' => $stored('teaser')],
|
||||
['id' => 'kurz', 'label' => 'Kurzbeschreibung', 'model' => 'summary', 'kind' => 'textarea', 'rows' => 3, 'stored' => $stored('summary'), 'hilfe' => 'Erscheint auf Website- und Bibliothekskarten.'],
|
||||
['id' => 'beschreibung', 'label' => 'Ausführliche Beschreibung', 'model' => 'descriptionText', 'kind' => 'textarea', 'rows' => 8, 'stored' => $stored('description'), 'hilfe' => 'Bleibt in der Verwaltung und in Detailansichten. Kein Lehrtext.'],
|
||||
['id' => 'kurz', 'label' => 'Kurzbeschreibung', 'model' => 'summary', 'kind' => 'rich', 'stored' => $stored('summary'), 'hilfe' => 'Erscheint auf Website- und Bibliothekskarten.'],
|
||||
['id' => 'beschreibung', 'label' => 'Ausführliche Beschreibung', 'model' => 'descriptionText', 'kind' => 'rich', 'stored' => $stored('description'), 'hilfe' => 'Bleibt in der Verwaltung und in Detailansichten. Kein Lehrtext.'],
|
||||
['id' => 'suche', 'label' => 'Suchbegriffe', 'model' => 'searchTerms', 'kind' => 'text', 'gruppe' => 'weitere', 'stored' => $stored('search_terms'), 'placeholder' => 'Begriffe, durch Komma getrennt'],
|
||||
['id' => 'einsatz', 'label' => 'Hinweise für den Einsatz', 'model' => 'usageNote', 'kind' => 'textarea', 'rows' => 3, 'gruppe' => 'weitere', 'stored' => $stored('usage_note')],
|
||||
['id' => 'lizenz', 'label' => 'Interner Lizenzvermerk', 'model' => 'licenseNote', 'kind' => 'textarea', 'rows' => 3, 'gruppe' => 'weitere', 'stored' => $stored('license_note'), 'hilfe' => 'Nur intern sichtbar.'],
|
||||
@@ -1040,7 +1051,7 @@ public function previewHtml(): string
|
||||
$draft = [
|
||||
'working_title' => $this->workingTitle,
|
||||
'display_title' => $this->displayTitle,
|
||||
'summary' => $this->summary,
|
||||
'summary' => FormattedText::plain($this->summary),
|
||||
'thumbnail_alt' => $this->thumbnailAlt,
|
||||
];
|
||||
|
||||
@@ -1053,7 +1064,7 @@ public function previewHtml(): string
|
||||
'type' => $element->output_class === 'film' ? 'film' : 'material',
|
||||
'url' => '#vorschau',
|
||||
'title' => $title !== '' ? $title : $element->working_title,
|
||||
'summary' => trim($this->summary) !== '' ? trim($this->summary) : null,
|
||||
'summary' => FormattedText::plain($this->summary) !== '' ? FormattedText::plain($this->summary) : null,
|
||||
'kind' => PublicMaterialReader::outputLabel((string) $element->output_class),
|
||||
'hide_status' => true,
|
||||
'image' => trim($this->thumbnailAlt) !== '' ? trim($this->thumbnailAlt) : $title,
|
||||
|
||||
Reference in new issue
Block a user