diff --git a/resources/dist/filament-tiptap-editor.js b/resources/dist/filament-tiptap-editor.js index 20fea622..c0b3b93d 100644 --- a/resources/dist/filament-tiptap-editor.js +++ b/resources/dist/filament-tiptap-editor.js @@ -232,4 +232,4 @@ lodash/lodash.js: * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) -*/ +*/ \ No newline at end of file diff --git a/resources/js/plugin.js b/resources/js/plugin.js index 0625d552..fbc212f7 100644 --- a/resources/js/plugin.js +++ b/resources/js/plugin.js @@ -458,6 +458,7 @@ export default function tiptap({ if (link.href === '' && link.id === null) { this.unsetLink(); + return; } @@ -478,6 +479,9 @@ export default function tiptap({ .selectTextblockEnd() .run(); }, + unsetLink() { + this.editor().chain().focus().extendMarkRange('link').unsetLink().selectTextblockEnd().run(); + }, insertSource(event) { this.updateEditorContent(event.detail.source); }, diff --git a/resources/views/tiptap-editor.blade.php b/resources/views/tiptap-editor.blade.php index e636e785..fc24b050 100644 --- a/resources/views/tiptap-editor.blade.php +++ b/resources/views/tiptap-editor.blade.php @@ -53,6 +53,7 @@ class="relative z-0 tiptap-wrapper rounded-md bg-white dark:bg-gray-900 focus-wi x-on:click.away="focused = false" x-on:keydown.escape="fullScreenMode = false" x-on:insert-content.window="insertContent($event)" + x-on:unset-link.window="$event.detail.statePath === '{{ $statePath }}' ? unsetLink() : null" x-on:update-editor-content.window="updateEditorContent($event)" x-on:refresh-tiptap-editors.window="refreshEditorContent()" x-on:dragged-block.stop="$wire.mountFormComponentAction('{{ $statePath }}', 'insertBlock', { diff --git a/src/Actions/LinkAction.php b/src/Actions/LinkAction.php index 3a40a3dd..250e4279 100644 --- a/src/Actions/LinkAction.php +++ b/src/Actions/LinkAction.php @@ -95,7 +95,6 @@ protected function setUp(): void $component->state($component->getState()); })->extraModalFooterActions(function (Action $action): array { - if ($action->getArguments()['href'] !== '') { return [ $action->makeModalSubmitAction('remove_link', [])