diff --git a/packages/forms/src/Components/RichEditor.php b/packages/forms/src/Components/RichEditor.php index c6ca90b2d2..0b2d861c65 100644 --- a/packages/forms/src/Components/RichEditor.php +++ b/packages/forms/src/Components/RichEditor.php @@ -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)) { diff --git a/packages/forms/src/Components/RichEditor/Actions/CustomBlockAction.php b/packages/forms/src/Components/RichEditor/Actions/CustomBlockAction.php index 2a95929794..945b835ca1 100644 --- a/packages/forms/src/Components/RichEditor/Actions/CustomBlockAction.php +++ b/packages/forms/src/Components/RichEditor/Actions/CustomBlockAction.php @@ -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']);