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:
1 parent
219962daff
commit
c57a506f85
27 files changed
+1729
-219
No files matched your search
@@ -4,6 +4,9 @@
|
||||
|
||||
use App\Domain\Catalog\FormattedText;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\RichEditor\RichEditorTool;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Support\Js;
|
||||
|
||||
/**
|
||||
* Der eine Editor für formatierte Texte (ADR-50): immer dieselbe Symbolleiste, dasselbe Ergebnis (bereinigtes HTML).
|
||||
@@ -15,10 +18,27 @@ final class RichField
|
||||
* @param ?string $label Bezeichnung des Felds; sie ist auch der Name für Hilfstechnik
|
||||
* @param bool $live Arbeitsplätze gleichen beim Verlassen des Felds ab ({@see ManagesRichFields}); Dialoge nicht
|
||||
* @param bool $hideLabel Die Bezeichnung zeigt der Arbeitsplatz selbst
|
||||
* @param bool $images Bilder aus dem Medienbestand einfügen; nur auf Seiten mit dem gemeinsamen Picker
|
||||
* ({@see ManagesEditorialSurface::openTextImagePicker()})
|
||||
*/
|
||||
public static function make(string $name, ?string $label = null, bool $live = true, bool $hideLabel = false): RichEditor
|
||||
public static function make(string $name, ?string $label = null, bool $live = true, bool $hideLabel = false, bool $images = false): RichEditor
|
||||
{
|
||||
$field = RichEditor::make($name)->toolbarButtons(FormattedText::TOOLBAR);
|
||||
$toolbar = FormattedText::TOOLBAR;
|
||||
|
||||
if ($images) {
|
||||
array_splice($toolbar, count($toolbar) - 1, 0, [['bild']]);
|
||||
}
|
||||
|
||||
$field = RichEditor::make($name)->toolbarButtons($toolbar);
|
||||
|
||||
if ($images) {
|
||||
$field->tools([
|
||||
RichEditorTool::make('bild')
|
||||
->label('Bild aus dem Medienbestand einfügen')
|
||||
->icon(Heroicon::Photo)
|
||||
->jsHandler('$wire.openTextImagePicker('.Js::from($name).', editorSelection)'),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($live) {
|
||||
$field->live(onBlur: true);
|
||||
|
||||
Reference in new issue
Block a user