Halte ungenutzte Medien bearbeitbar und lege Dateien direkt im Modul an.
Deploy Test / test (push) Successful in 26s
Deploy Test / deploy (push) Successful in 30s

Eine Fassung wird erst unveränderlich, wenn sie freigegeben und verwendet wird. Das Auge am Listeneintrag öffnet die Vorschau.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-17 10:34:42 +01:00
1 parent 1fb48783bf
commit c73207f2c3
11 files changed
+547 -25

No files matched your search

@@ -39,6 +39,8 @@ class ViewContentElement extends ViewRecord
public string $frameSecond = '';
public string $bodyDraft = '';
public string $thumbnailAlt = '';
public string $pictureFeedback = '';
@@ -56,6 +58,7 @@ public function mount(int|string $record): void
}
$this->thumbnailAlt = (string) ($this->getRecord()->thumbnail_alt ?? '');
$this->syncBodyDraft();
}
public function getSubheading(): string|Htmlable|null
@@ -74,6 +77,25 @@ public function showVersion(int $version): void
{
abort_unless($this->ownedVersion($version) instanceof ContentElementVersion, 404);
$this->fassung = $version;
$this->syncBodyDraft();
}
public function saveShownText(): void
{
$shown = $this->shownVersion();
if (! ContentElementResource::editor() || ! $shown instanceof ContentElementVersion || $shown->element?->output_class !== 'text') {
return;
}
$created = app(ContentService::class)->isCommitted($shown);
$this->report(function () use ($shown): void {
app(ContentService::class)->reviseElementContent($shown, $this->bodyDraft);
}, $created
? 'Die neue Fassung ist angelegt. Die bisherige bleibt erhalten.'
: 'Der Text ist in derselben Fassung gespeichert.');
$this->getRecord()->unsetRelation('versions');
$this->syncBodyDraft();
}
public function adoptFrame(): void
@@ -282,6 +304,7 @@ private function viewerData(): array
?? $versions->first(fn (ContentElementVersion $version): bool => $version->status === ContentVersionStatus::Bereit)
?? $versions->first();
$preview = app(ContentPreviewController::class);
$committed = $shown instanceof ContentElementVersion && app(ContentService::class)->isCommitted($shown);
return [
'element' => $element,
@@ -292,11 +315,21 @@ private function viewerData(): array
'pillars' => $element->pillars->pluck('name')->all(),
'usage' => app(CatalogReading::class)->elementUsage($element),
'canRevise' => ContentElementResource::editor(),
'canEditBody' => ContentElementResource::editor()
&& $shown instanceof ContentElementVersion
&& $element->output_class === 'text'
&& $shown->status !== ContentVersionStatus::Gesperrt,
'bodyCommitted' => $committed,
'pictureUrl' => ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path),
'pictureCaption' => $this->pictureCaption($element),
];
}
private function syncBodyDraft(): void
{
$this->bodyDraft = (string) ($this->shownVersion()?->body ?? '');
}
private function shownVersion(): ?ContentElementVersion
{
/** @var ContentElement $element */