Details
Description
Reproduction
- Create a new Document Type and add the Rich Text Editor field group
- Set the htmlprocessor to `no-filter` and add { allowedContent: true } to the ckeditor.config.overlayed.json (documentation here).
- Create a new document using the newly created Document Type.
- Enter the below code snippet as the content
- Upon saving, the `<style>` tag gets stripped out
<style>
.heading { color: red }
</style>
<h1 class="heading">Heading</h1>
Cause
Third party HTML cleaner was bumped to 2.29 per CMS-15420 in 13.4.24, 14.7.15, 15.3.0.
See https://htmlcleaner.sourceforge.net/release.php
April. 29, 2023{_}: HtmlCleaner release 2.28
- 229 style-tag should not be allowed in body in HTML5
Solution proposed by mmilicevic
import org.htmlcleaner.*; public class BloomreachHtmlProvider extends Html5TagProvider { public static final BloomreachHtmlProvider INSTANCE = new BloomreachHtmlProvider(); public BloomreachHtmlProvider() { final TagInfo tagInfo = new TagInfo("style", ContentType.text, BelongsTo.HEAD_AND_BODY, false, false, false, CloseTag.required, Display.none); this.put("style", tagInfo); } } // org.onehippo.cms7.services.htmlprocessor.HtmlProcessorImpl fork: parser = new HtmlCleaner(BloomreachHtmlProvider.INSTANCE, properties);