awcodes / filament-tiptap-editor

A Rich Text Editor plugin for Filament Forms.
MIT License
281 stars 77 forks source link

Custom extension is not working #343

Closed fordiquez closed 6 months ago

fordiquez commented 6 months ago

Filament Version

v3.2.45

Plugin Version

v.3.2.25

PHP Version

8.2

Problem description

Custom extension is not work correctly. image image

Expected behavior

Must be worked tiptap extension: https://tiptap.dev/docs/editor/api/nodes/mention

Steps to reproduce

Init custom extension in /resources/js/tiptap/extensions.js

import Mention from "./mention.js";

window.TiptapEditorExtensions = { mention: [Mention] }

/config/filament-tiptap-editor.php 'extensions_script' => 'resources/js/tiptap/extensions.js', 'extensions_styles' => null, 'extensions' => [ [ 'id' => 'mention', 'name' => 'Mention', 'button' => 'mention', 'parser' => \App\TiptapExtensions\Mention::class, ] ],

Reproduction repository

No response

Relevant log output

No response

awcodes commented 6 months ago

You might need to set your app's package.json to use 'module'.

The plugin just loads the file through Vite.

Seems like your script isn't getting processed during the build.

fordiquez commented 6 months ago

You might need to set your app's package.json to use 'module'.

The plugin just loads the file through Vite.

Seems like your script isn't getting processed during the build.

The package.json has module image

awcodes commented 6 months ago

Only other issues i've seen like this is that it doesn't work with npm run dev but does work with npm run build.

If you can provide a reproduction repo I can investigate further when I get some time.

barkoczi commented 4 months ago

I encountered the same issue. The script tag is not correctly add to the page html source: `

` As you can see the type=module is missing.

I think the problem was in the vendor/awcodes/filament-tiptap-editor/src/FilamentTiptapEditorServiceProvider.php line 41:

awcodes commented 4 months ago

If you are running it through Vite though the module shouldn’t matter. I am successfully using it on apps with out module.

awcodes commented 4 months ago

Feel free to PR the change and I'll be happy to review it further though.

mybouhssina commented 1 month ago

@awcodes can the PR be merged please? I Have the same issue

mybouhssina commented 1 month ago

as a temporary fix I just removed the script from filament-tiptap-editor.php: // 'extensions_script' => 'resources/js/tiptap/extensions.js', and then in my AppServiceProvider: FilamentAsset::register([Js::make('tiptap-custom-extension-scripts', Vite::asset('resources/js/tiptap/extensions.js'))->module()], 'awcodes/tiptap-editor'); Thank you so much btw @barkoczi, I wasted a lot of time trying to figure out wtf is going on.