Allow safe inline style attributes in rich text component?

The RichText component does not currently allow inline styling of html. Would it be possible to allow safe inline style attributes?

Example using RichText together with the Quill editor from Anvil Extras:

Using the Quill editor with colors returns:
<p><span style="color: rgb(230, 0, 0);">Hello</span></p>

Setting this as html content of a RichText component does not display the color .

A html safe list I found lists these as safe inline style attributes:
“margin”, “margin-left”, “margin-top”, “margin-bottom”, “margin-right”, “padding”, “padding-left”, “padding-top”, “padding-bottom”, “padding-right”, “border”, “font-size”, “background-color”, “color”, “font-weight”, “font-style”, “font-family”

5 Likes

Just discovered the lack of color styling myself. Seems like a pretty safe thing to include in the restricted HTML set.

4 Likes