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

+13 -2
View File
@@ -2,6 +2,7 @@
namespace App\Filament\Support;
use App\Domain\Catalog\EmbeddedImages;
use App\Domain\Catalog\FormattedText;
use Filament\Forms\Components\RichEditor;
use Filament\Schemas\Components\Component;
@@ -41,6 +42,16 @@ protected function richFelder(): array
return [];
}
/**
* Eigenschaften, deren Editor Bilder aus dem Medienbestand einfügen darf (Textinhalte, nicht Kurzangaben).
*
* @return list<string>
*/
protected function richBilder(): array
{
return [];
}
/** @return list<string> */
protected function richNamen(): array
{
@@ -51,7 +62,7 @@ public function richTextSchema(Schema $schema): Schema
{
return $schema
->statePath('rich')
->components(array_map(fn (string $name, string $label): RichEditor => RichField::make($name, $label, hideLabel: true), $this->richNamen(), $this->richFelder()));
->components(array_map(fn (string $name, string $label): RichEditor => RichField::make($name, $label, hideLabel: true, images: in_array($name, $this->richBilder(), true) && method_exists($this, 'openTextImagePicker')), $this->richNamen(), $this->richFelder()));
}
public function richKomponente(string $name): ?Component
@@ -93,7 +104,7 @@ protected function richPush(string $name): void
}
$canonical = FormattedText::canonical((string) $this->{$name});
$component->state($canonical === '' ? null : $canonical);
$component->state($canonical === '' ? null : FormattedText::forEditor($canonical, fn (int $id): string => EmbeddedImages::staffSource($id)));
$this->richSeen[$name] = md5($canonical);
}