[7.2.1 Platform Bug] HTMLBox component not working properly on Platform 7.2.1

Hello,

Setting the id property of a div inside a htmlBox component is faulty. This is something that appeared after we migrated our project from Platform version 7.1.3 to 7.2.1. Also, this might be a bigger issue with the htmlBox component than just not setting the id right.

The declaration of my <htmlBox/> component:

<htmlBox id="htmlBox">
    <templateContents>
        <![CDATA[<div id="foodProductPictorial" style="height: 100%;"></div>]]>
    </templateContents>
</htmlBox>

This is how the <htmlBox/> is rendered in the actual page’s HTML file.

<div class="v-customlayout v-layout v-widget v-has-width v-has-height" cuba-id="htmlBox" style="border-style: none; margin: 0px; padding: 0px; width: 100%; height: 100%;">
    <div style="height:100%"></div>
</div>

Reproducing test project: htmlboxissue.zip (77.8 KB)

Thank you,
Alex

Hi,

Since 7.2 all content rendered to HTML is sanitized by default. See details in the following issue.
You can switch off sanitization for a particular component:

<htmlBox htmlSanitizerEnabled="false">

or globally using cuba.web.htmlSanitizerEnabled property.

Also you can customize sanitization rules, see HtmlSanitizer#setPolicyFactory.

1 Like