Biete Tabellen und Bilder im gemeinsamen Texteditor an und setze sie in Ansicht und PDF

Tabellen und Bilder gehören zur festen Auswahl von FormattedText. Ein Bild
ist ein Verweis auf eine freigegebene Bildfassung und kommt per Picker aus
dem Medienbestand; der Stand schreibt die Bildfassung mit fest, die Rechte
entscheidet DecideAccess. Der PDF-Satz (PdfFlow) ist für Übung und kommende
Dokumente gemeinsam; PdfDocument kann zusätzlich Bilder, Flächen, Verweise
und Lesezeichen, Belege bleiben byte-gleich.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-24 11:31:03 +01:00
1 parent 219962daff
commit c57a506f85
27 files changed
+1729 -219

No files matched your search

+33 -1
View File
@@ -23,7 +23,7 @@ public function expand(ContentElementVersion|CompositionVersion $node, string $p
'path' => $path !== '' ? $path : $node->element->working_title,
'requirement' => CompositionMember::REQUIRED,
'variant' => null,
]];
], ...$this->embeddedImages($node, $path !== '' ? $path : $node->element->working_title, null)];
}
if (in_array($node->composition_id, $stack, true)) {
@@ -51,6 +51,10 @@ public function expand(ContentElementVersion|CompositionVersion $node, string $p
'variant' => $variantKey,
];
foreach ($this->embeddedImages($member->contentElementVersion, $segment, $variantKey) as $image) {
$rows[] = $image;
}
continue;
}
@@ -79,6 +83,34 @@ public function expand(ContentElementVersion|CompositionVersion $node, string $p
return $rows;
}
/**
* Bilder, auf die ein Text verweist, gehören zum Inhalt des Stands: Nur was im Stand steht, darf ein Mitglied sehen
* (`DecideAccess`), und eine Sperre des Bildes wirkt über denselben Weg. Ein fehlendes Bild macht den Text nicht
* unbrauchbar, daher „ergänzend“.
*
* @return list<array{version_id: int, role: string, path: string, requirement: string, variant: string|null}>
*/
private function embeddedImages(?ContentElementVersion $text, string $path, ?string $variantKey): array
{
if ($text === null || trim((string) $text->body) === '' || ! str_contains((string) $text->body, 'img')) {
return [];
}
$rows = [];
foreach (FormattedText::imageIds($text->body) as $id) {
$rows[] = [
'version_id' => $id,
'role' => 'Bild',
'path' => $path.' / Bild',
'requirement' => CompositionMember::SUPPLEMENTARY,
'variant' => $variantKey,
];
}
return $rows;
}
public function resolvedHash(ContentElementVersion|CompositionVersion $node): string
{
$ids = array_values(array_unique(array_column($this->expand($node), 'version_id')));