In my current setup using Rails 4.1.4, Ruby 2.1.2, and CKEditor 4.1.1 integrated with Rails Admin, I am facing an issue. Whenever I enter text in the CKEditor text area and apply a font or font size, it saves successfully. However, upon viewing the content, instead of seeing
<span style="font-size 36pt">text</span>
, I only see <span>text</span>
.
I have experimented with both config.allowedContent = true;
and
config.extraAllowedContent = 'style;*[id,rel](*){*}';
, as well as using both configurations simultaneously. Yet, the problem persists.
I initially suspected that the issue might be related to the rails_html_sanitizer. At present, my configuration for rails_html_sanitizer includes:
HTML::WhiteListSanitizer.allowed_tags.merge(%w(iframe table tbody tr td tfoot thead colgroup col style))
HTML::WhiteListSanitizer.allowed_attributes.merge(%w(target))
My desired outcome is to utilize CKEditor's font and font size options without losing the style attributes from the span classes. Most solutions I have come across suggest modifying the config.js file, but my attempts have been unsuccessful thus far. Any guidance or alternative approaches would be greatly appreciated. Thank you.