diff --git a/src/Actions/LinkAction.php b/src/Actions/LinkAction.php index cf45d1a9..781e8858 100644 --- a/src/Actions/LinkAction.php +++ b/src/Actions/LinkAction.php @@ -88,13 +88,22 @@ protected function setUp(): void ); $component->state($component->getState()); - })->extraModalFooterActions(fn (Action $action): array => [ - $action->makeModalSubmitAction('remove_link', []) - ->color('danger') - ->extraAttributes([ - 'x-on:click' => new HtmlString('$dispatch(\'unset-link\'); close()'), - 'style' => 'margin-inline-start: auto;' - ]) - ]); + })->extraModalFooterActions(function (Action $action): array { + + if ($action->getArguments()['href'] !== '') { + return [ + $action->makeModalSubmitAction('remove_link', []) + ->color('danger') + ->extraAttributes(function () use ($action) { + return [ + 'x-on:click' => new HtmlString("\$dispatch('unset-link', {'statePath': '{$action->getComponent()->getStatePath()}'}); close()"), + 'style' => 'margin-inline-start: auto;' + ]; + }) + ]; + } + + return []; + }); } } \ No newline at end of file