Hi, I've implemented action-text in our Rails 6 app to get some user-provided text that we put in generated PDFs (prawn). Everything is great except that Trix doesn't support the underline tag.
I've updated ActionText Trix.config.textAttributes to include u as a valid tagName and I've created a custom toolbar that adds a button for underline. The <u> tags are properly getting stored in the database when the form is saved.
I then added Rails::Html::SafeListSanitizer.allowed_tags << "u" to get the rendered show view to stop stripping the <u> tags.
So, everything is great except when re-rendering the editor form, the <u> tags are stripped.
In reading discussions and looking at the code, defining u as a tagName in Trix.config.textAttributes should mean that Trix.HTMLSanitizer includes that tag in the list of allowed attributes, but that isn't happening.
Any ideas on this last step to make a custom textAttribute tag work correctly for a full life-cycle?
Details
- Trix version: Rails 6.0.3
- Browser name and version Chrome latest
- Operating system: Mac OS X
Hi, I've implemented action-text in our Rails 6 app to get some user-provided text that we put in generated PDFs (prawn). Everything is great except that Trix doesn't support the underline tag.
I've updated ActionText
Trix.config.textAttributesto includeuas a validtagNameand I've created a custom toolbar that adds a button for underline. The<u>tags are properly getting stored in the database when the form is saved.I then added
Rails::Html::SafeListSanitizer.allowed_tags << "u"to get the rendered show view to stop stripping the<u>tags.So, everything is great except when re-rendering the editor form, the
<u>tags are stripped.In reading discussions and looking at the code, defining
uas atagNameinTrix.config.textAttributesshould mean thatTrix.HTMLSanitizerincludes that tag in the list of allowed attributes, but that isn't happening.Any ideas on this last step to make a custom
textAttributetag work correctly for a full life-cycle?Details