wire-elements / pro-demo

8 stars 0 forks source link

using the Insert component in Filament Forms RichText Editor #5

Open andreaskviby opened 11 months ago

andreaskviby commented 11 months ago

We use Filament Admin for our applications and now we bought your excellent package to utilize the Insert Component to have a way to insert codes and mention people. We use the Rich Text editor in Filament which essentially is a Trix Editor. We can't figure out how to implement your component into this.

Forms\Components\RichEditor::make('treatment')
                        ->disableToolbarButtons([
                            'attachFiles',
                            'codeBlock',
                            'redo',
                            'undo',
                            'blockquote',
                            'link',
                            'h2',
                            'h3',
                        ])->extraInputAttributes(['x-data' => 'SupportsWepInsert({ types: ["diagnos"] })', 'x-bind' => 'insertInput'])
                        ->lazy()
                        ->afterStateUpdated(function (Field $component, mixed $state) {
                            if (! $this->selectedJournal) {
                                return;
                            }
                            $this->selectedJournal->update([$component->getName() => $state]);
                        })
                        ->label('Behandling')
                        ->dehydrated(false)
                        ->columnSpan(2)
                        ->disabled(function () {
                            return $this->selectedJournal?->signed_by;
                        }),

We have tested the above but no matter how we do it we can't get it to work. Any ideas?