elegantthemes / Divi-Beta

8 stars 0 forks source link

CodeContainer Removing Tags & Attributes #22

Open dtcblyth opened 1 year ago

dtcblyth commented 1 year ago

Related Thread: https://discord.com/channels/1041765492907589683/1095516318796615782

Background:

My module, Table Maker, uses a code field for content input. It also uses some non-standard HTML tags to allow the user to style table cells, and add images and icons to their tables. These tags are:

<cell></cell>
<image></image>
<icon></icon>

These tags also have some none-standard attributes which allow the user some further customisation. For example:

<cell background="#000000" color="#000000">Hello World</cell>
<cell border-top="4px dashed #000000">Hello World</cell>
<icon size="32px"></icon>
<image href="https://divi-modules.com"></image>

Note: There are more attributes than those above. I can provide a complete list if you require it.

Problem:

In D4 everything works fine. However, when using the <CodeContainer /> component in D5 these tags and attributes are being removed from the content after saving and reloading the Visual Builder.

I can add the tags and attributes that Table Maker needs with the wp_kses_allowed_html() filter, however, I did not need to do this in D4. I’m also concerned that there might be other content that might be being removed that I am not yet aware of, and that this could lead to data loss for Table Maker users and other Divi extensions which use the component.