diff --git a/app/Filament/Admin/Resources/ElectionResource.php b/app/Filament/Admin/Resources/ElectionResource.php index 16ac91c..ea9c675 100644 --- a/app/Filament/Admin/Resources/ElectionResource.php +++ b/app/Filament/Admin/Resources/ElectionResource.php @@ -17,6 +17,7 @@ use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\Fieldset; use Filament\Forms\Components\KeyValue; +use Filament\Forms\Components\RichEditor; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Toggle; @@ -160,7 +161,7 @@ public static function form(Form $form): Form ->columnSpanFull() ->nullable(), - TextInput::make('properties.alert') + RichEditor::make('properties.alert') ->label(__('app.field.alert')) ->columnSpanFull() ->nullable(), @@ -224,7 +225,8 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('properties.alert') ->label(__('app.field.alert')) - ->columnSpanFull(), + ->columnSpanFull() + ->html(), ]), Infolists\Components\Section::make() diff --git a/app/View/Components/Election/Alert.php b/app/View/Components/Election/Alert.php index 01c073d..128fae5 100644 --- a/app/View/Components/Election/Alert.php +++ b/app/View/Components/Election/Alert.php @@ -6,15 +6,19 @@ use App\Models\Election; use Illuminate\Contracts\View\View; +use Illuminate\Support\HtmlString; +use Illuminate\Support\Str; use Illuminate\View\Component; class Alert extends Component { - public ?string $alert = null; + public ?HtmlString $alert = null; public function __construct(Election $election) { - $this->alert = data_get($election, 'properties.alert'); + $this->alert = Str::of(data_get($election, 'properties.alert')) + ->sanitizeHtml() + ->toHtmlString(); } public function shouldRender(): bool diff --git a/resources/views/components/alert.blade.php b/resources/views/components/alert.blade.php index 18ca971..78919bd 100644 --- a/resources/views/components/alert.blade.php +++ b/resources/views/components/alert.blade.php @@ -1,5 +1,3 @@