mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
do not use attribute inside custom block form
This commit is contained in:
@@ -603,6 +603,13 @@ class RichEditor extends Field implements Contracts\CanBeLengthConstrained
|
||||
|
||||
public function getContentAttribute(): ?RichContentAttribute
|
||||
{
|
||||
// Do not read content attributes from the model when the rich editor is nested
|
||||
// inside a custom block action modal, since the content attribute should only
|
||||
// be used to configure the parent rich editor.
|
||||
if ($this->getRootContainer()->getOperation() === CustomBlockAction::NAME) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$model = $this->getModelInstance();
|
||||
|
||||
if (! ($model instanceof HasRichContent)) {
|
||||
|
||||
@@ -9,9 +9,11 @@ use Filament\Support\Enums\Width;
|
||||
|
||||
class CustomBlockAction
|
||||
{
|
||||
public const NAME = 'customBlock';
|
||||
|
||||
public static function make(): Action
|
||||
{
|
||||
return Action::make('customBlock')
|
||||
return Action::make(static::NAME)
|
||||
->fillForm(fn (array $arguments): array => $arguments['config'] ?? [])
|
||||
->modalHeading(function (array $arguments, RichEditor $component): ?string {
|
||||
$block = $component->getCustomBlock($arguments['id']);
|
||||
|
||||
Reference in New Issue
Block a user