From c240edf18337d853d69c41d1d73125d0d145451f Mon Sep 17 00:00:00 2001 From: ruud-sibi <155430071+ruud-sibi@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:58:12 +0000 Subject: [PATCH 1/4] Added Grid Builder Action to HasCustomActions.php --- src/Concerns/HasCustomActions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Concerns/HasCustomActions.php b/src/Concerns/HasCustomActions.php index 727478ec..bbbd46fd 100644 --- a/src/Concerns/HasCustomActions.php +++ b/src/Concerns/HasCustomActions.php @@ -13,6 +13,8 @@ trait HasCustomActions public ?string $editMediaAction = null; + public ?string $gridBuilderAction = null; + public function linkAction(string | Closure $action): static { $this->linkAction = $action; @@ -54,4 +56,17 @@ public function getEditMediaAction(): Action return $action::make(); } + + public function gridBuilderAction(string | Closure $action): static + { + $this->gridBuilderAction = $action; + + return $this; + } + + public function getGridBuilderAction(): Action + { + $action = $this->evaluate($this->gridBuilderAction) ?? config('filament-tiptap-editor.grid_builder_action'); + return $action::make(); + } } From 86dddef94a5072faf6de0679b05a3902efb8d9f2 Mon Sep 17 00:00:00 2001 From: ruud-sibi <155430071+ruud-sibi@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:59:05 +0000 Subject: [PATCH 2/4] Updated registerActions to reflect changes --- src/TiptapEditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TiptapEditor.php b/src/TiptapEditor.php index 25b18790..555655e2 100644 --- a/src/TiptapEditor.php +++ b/src/TiptapEditor.php @@ -168,7 +168,7 @@ protected function setUp(): void $this->registerActions([ SourceAction::make(), OEmbedAction::make(), - GridBuilderAction::make(), + fn (): Action => $this->getGridBuilderAction(), fn (): Action => $this->getLinkAction(), fn (): Action => $this->getMediaAction(), fn (): Action => $this->getInsertBlockAction(), From 8a10e817cbdee609306691c220110c44cfa19779 Mon Sep 17 00:00:00 2001 From: ruud-sibi <155430071+ruud-sibi@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:59:48 +0000 Subject: [PATCH 3/4] Added grid_builder_action to config --- config/filament-tiptap-editor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/filament-tiptap-editor.php b/config/filament-tiptap-editor.php index 9c5b082e..8d92523a 100644 --- a/config/filament-tiptap-editor.php +++ b/config/filament-tiptap-editor.php @@ -37,6 +37,7 @@ // 'media_action' => Awcodes\Curator\Actions\MediaAction::class, 'edit_media_action' => FilamentTiptapEditor\Actions\EditMediaAction::class, 'link_action' => FilamentTiptapEditor\Actions\LinkAction::class, + 'grid_builder_action' => FilamentTiptapEditor\Actions\GridBuilderAction::class, /* |-------------------------------------------------------------------------- From 0cf07b61b67ef2ac2d821ea580b680b435478c70 Mon Sep 17 00:00:00 2001 From: ruud-sibi <155430071+ruud-sibi@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:01:15 +0000 Subject: [PATCH 4/4] Updated README --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b272f00..ac232867 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ TiptapEditor::make('content') ## Overrides -The Link and Media modals are built using Filament Form Component Actions. This means it is easy enough to swap them out with your own implementations. +The Link, Media and Grid Builder modals are built using Filament Form Component Actions. This means it is easy enough to swap them out with your own implementations. ### Link Modal @@ -227,6 +227,12 @@ You may override the default Media modal with your own Action and assign to the See `vendor/awcodes/filament-tiptap-editor/src/Actions/MediaAction.php` for implementation. +### Grid Builder Modal + +You may override the default Grid Builder modal with your own Action and assign to the `grid_builder_action` key in the config file. Make sure the default name for your action is `filament_tiptap_grid`. + +See `vendor/awcodes/filament-tiptap-editor/src/Actions/GridBuilderAction.php` for implementation. + ### Initial height of editor field You can add extra input attributes to the field with the `extraInputAttributes()` method. This allows you to do things like set the initial height of the editor.