-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added support for HTML className for Block objects #791
base: main
Are you sure you want to change the base?
Conversation
If this is going to be eventually supported I would love to see this extended to |
Awesome work @SergeyBurtsev! This will make adding classes to block objects way easier. |
Thank you @clarkcode ! Maybe I did this patch too hastly without discussing with anyone here and only then realized that it can violate Trix philisophy and long-term plans. I am less professional than others here, so I am not surprised if I missed the point :) |
When will this be resolved? I been thinking all the time that TRIX can be extended with custom toolbar items, but apparently there's no way I can extend it to support a block level element like "textAlign: center" in a clean way without className support. This is a dealbreaker since I have to support existing rich text content and I've lost a fair amount of time on researching this. I'm very happy with TRIX but can you please give an update on this matter? |
Hoping there's some movement on merging this soon as well. I need to wrap some text in a div with a class in a project I'm working on. Is there any workaround for this currently until this is merged? |
Any updates on this? |
I am currently attempting to impliment mentions in a Trix editor. I am attempting to do something like |
@SergeyBurtsev was hoping you might be able to help advise.
|
@richlarcombe I've refactored the fork, so now it should work the way you suggested. |
@SergeyBurtsev, this is a great help, many thanks. |
@SergeyBurtsev actually after further testing have found that this issue only occurs for multiple strings in the class field. |
@richlarcombe You are right about multiple classes. I've updated the HTMLParser, so it now compares full className string of the element, so you could use it like: But I still don't know if this addon is valuable for the core Trix editor. Maybe I should close this PR and implement it as a separate patch, which can by applied over the official release if needed. |
@SergeyBurtsev thanks for that, works great. |
@SergeyBurtsev I would donate towards this patch. |
@SergeyBurtsev thank you for this! :) |
Is this ever be implemented? It would be such a game-breaker feature for Trix usage... @dhh |
@Mth0158 I already published adding this PR custom trix version, including the align center and right button in toolbar also, you can check the code if you having my similar requirement. |
This PR allows to use HTML class attribute (className) for Block level objects and that allows to add extended functionality like text alignment adding and toggling those classes for the nearest block object.