do not use attribute inside custom block form

This commit is contained in:
Dan Harrin
2025-09-14 15:01:02 +01:00
parent 07c9483e63
commit 9950d8ade5
2 changed files with 10 additions and 1 deletions
@@ -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']);