Skip to content

Commit

Permalink
Merge pull request #565 from awcodes/fix/tool-includes
Browse files Browse the repository at this point in the history
Fix: ensure all tools get registered
  • Loading branch information
awcodes authored Feb 1, 2025
2 parents 0846f4e + cee1aef commit 11f3958
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 23 deletions.
44 changes: 22 additions & 22 deletions resources/dist/filament-tiptap-editor.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion resources/js/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export default function tiptap({
tools = [],
disabled = false,
locale = 'en',
bubbleMenuTools = [],
floatingMenuTools = [],
placeholder = null,
mergeTags = [],
Expand All @@ -175,6 +176,7 @@ export default function tiptap({
updatedAt: Date.now(),
disabled: disabled,
locale: locale,
bubbleMenuTools: bubbleMenuTools,
floatingMenuTools: floatingMenuTools,
getExtensions() {
const tools = this.tools.map((tool) => {
Expand Down Expand Up @@ -229,7 +231,7 @@ export default function tiptap({
tippyOptions: {
duration: [500, 0],
maxWidth: 'none',
placement: 'top',
placement: 'auto',
theme: 'tiptap-editor-bubble',
interactive: true,
appendTo: this.$refs.element,
Expand Down Expand Up @@ -279,6 +281,14 @@ export default function tiptap({
});
}

if (this.bubbleMenuTools.length) {
this.bubbleMenuTools.forEach((tool) => {
if (!tools.includes(tool)) {
tools.push(tool);
}
});
}

tools.forEach((tool) => {
if (keys.includes(tool)) {
editorExtensions[tool].forEach((e) => {
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 @@ -43,6 +43,7 @@ class="relative z-0 tiptap-wrapper rounded-md bg-white dark:bg-gray-900 focus-wi
tools: @js($tools),
disabled: @js($isDisabled),
locale: '{{ app()->getLocale() }}',
bubbleMenuTools: @js($bubbleMenuTools),
floatingMenuTools: @js($floatingMenuTools),
placeholder: @js($getPlaceholder()),
mergeTags: @js($mergeTags),
Expand Down

0 comments on commit 11f3958

Please sign in to comment.