mohamedsabil83 / filament-forms-tinyeditor

A TinyMce Editor component for filament
MIT License
164 stars 37 forks source link

[Bug]: Data is not saved #101

Closed harlamoff closed 8 months ago

harlamoff commented 9 months ago

What happened?

Data is not saved in the tinyeditor field.

How to reproduce the bug

1) Make a change to the tinyeditor field 2) Click the Save button (if you remove focus from the tinyeditor field, the data will be saved successfully)

Package Version

v2.0.5

PHP Version

8.2.10

Laravel Version

10.22

Which operating systems does with happen with?

No response

Notes

filament 3.0.63


protected function getFormActions(): array
{
    return [
        $this->getSaveFormAction(), // don't work
        ...
    ];
}   

// original 
protected function getSaveFormAction(): Action
{
      return Action::make('save')
          ->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
          ->submit('save') // THIS problem
          ->keyBindings(['mod+s']);
}

// custom 
 protected function getSaveFormAction(): Action
  {
      return Action::make('save')
          ->action(function(){
              $this->save(); // its work
          });
  }
mohamedsabil83 commented 8 months ago

I guess it's something related to Filament/Livewire3, same as the change happened to ->action() method in the following example:

Before (Filament/Livewire2)

Action::make()->form()->action('save');

public function save($data) {} // You got the form data here

After (Filament/Livewire3)

Action::make()->form()->action('save');

public function save($data) {} // You didn't get the form data here

After (Filament/Livewire3)

Action::make()->form()->action(fn($data) => $this->save($data)); // Replaced to callback

public function save($data) {} // You got the form data here

I'll check more about that soon. Also, PR is welcome.