Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After saving styling for the first time and refreshing the page, the styling cannot be changed. #546

Open
mybouhssina opened this issue Jan 16, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@mybouhssina
Copy link

Filament Version

3.2.133

Plugin Version

3.5.3

PHP Version

8.2

Problem description

I tried this with both color and alignment (default) extensions, once you set it, save and reload the page it cannot be changed any longer.
Here is a video that explain the problem:
2025-01-16.webm
There is no output in the console.
As you can see in the video there is a double ";" that is added to the end of the text.
The problem disappears when I remove StyleExtension in TiptapConverter.php@62
(I m not sure what s the role of that extension, if someone can kindly explain it to me I would appreciate it.)
Thank you,
Youssef.

Expected behavior

Should be able to change style attributes after saving and reloading the page.

Steps to reproduce

Watch the video
2025-01-16.webm

Reproduction repository

https://github.com/mybouhssina/filament-tiptap-bug-repro

Relevant log output

No response

@mybouhssina mybouhssina added the bug Something isn't working label Jan 16, 2025
@awcodes
Copy link
Owner

awcodes commented Jan 26, 2025

Ok. So I spent a lot of time on this today. And I've come to the conclusion that it is a conflict/race condition between the style extension and things like color and text align, really anything that modifies the style attribute on an element. Now, certainly removing the style extension will make everything else work as expected, but it exists to allow arbitrary styles to be applied to elements, ie through the source code editor. Otherwise there would need to be explicit plugins for each possible style attribute. I'm not opposed to dropping it, but it would definitely be a breaking change. So, I'm still up in the air on trying to find a solution that will work instead of dropping it entirely. Will report back with any additional findings.

For now, though, I would suggest extending the converter's getExtensions() method with your own as long as you don't need arbitrary style declarations.

@mybouhssina
Copy link
Author

I see, I will do that. Thank you so much !

@mybouhssina
Copy link
Author

@awcodes I ended up storing data as Json as you ve suggested previously and it's working fine.
Extending TiptapConverter class and removing StyleExtension didn't solve the problem for some reason. Also, I think there is small bug, you bind TiptapEditor usign the string 'tiptap-converter' but when you resolve it in your helper you use
app(\FilamentTiptapEditor\TiptapConverter::class) And I don t think you re using the singleton binding anywhere in the app.
Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants