Rails sanitizer: allow specific styles in a style attribute

I am using rails-html-sanitizer and currently I am using the style attribute. However, I want some styles to be added to the whitelist.

Can I specify which styles to allow? For example, suppose the following:

style="text-align: center;"

In the documentation, I see the following, but I think this does the opposite of what I'm trying to do: white_list_sanitizer.sanitize_css('background-color: #000;')

In the case where I cannot whitelist certain styles, my next option was simply to attach the styles to certain classes.

+4
source share
1 answer

ActionView, , .

, .

0

Source: https://habr.com/ru/post/1651897/


All Articles