'#032551', 'gruen' => '#3b7b09', 'rot' => '#a8212b', 'grau' => '#3e4c5c']; /** * @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()}) * @param bool $website Texte der Website (Fließtext): zusätzlich Schriftgröße, Schriftfarbe und Ausrichtung aus festen * Werten ({@see FormattedText::SITE_SIZES}, {@see FormattedText::SITE_COLORS}); gespeichert wird * mit dem Webprofil von {@see FormattedText} */ public static function make(string $name, ?string $label = null, bool $live = true, bool $hideLabel = false, bool $images = false, bool $website = false): RichEditor { $toolbar = FormattedText::TOOLBAR; if ($website) { array_splice($toolbar, 1, 0, [['fontSize', 'textColor'], ['alignStart', 'alignCenter', 'alignEnd']]); } if ($images) { array_splice($toolbar, count($toolbar) - 1, 0, [['bild']]); } $field = RichEditor::make($name)->toolbarButtons($toolbar); if ($website) { $field ->plugins([new FontSizePlugin]) ->textColors(Arr::mapWithKeys( FormattedText::SITE_COLORS, fn (string $label, string $key): array => [$key => TextColor::make($label, self::SITE_COLOR_VALUES[$key])], )) ->customTextColors(false); } 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); } if ($label !== null) { $field->label($label); } return $label === null || $hideLabel ? $field->hiddenLabel() : $field; } }