Skip to content

Commit

Permalink
Merge pull request #237 from jyrkidn/unset-link
Browse files Browse the repository at this point in the history
Re-add unset link
  • Loading branch information
awcodes authored Dec 6, 2023
2 parents de640cd + 1b6fc2b commit 6b6ec16
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/dist/filament-tiptap-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions resources/js/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ export default function tiptap({

if (link.href === '' && link.id === null) {
this.unsetLink();

return;
}

Expand All @@ -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);
},
Expand Down
1 change: 1 addition & 0 deletions resources/views/tiptap-editor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
1 change: 0 additions & 1 deletion src/Actions/LinkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [])
Expand Down

0 comments on commit 6b6ec16

Please sign in to comment.