How to disable the Style Whitelist in Kupu

Kupu is the default WYSIWYG editor that ships with Plone 2.1.×.

By default, Kupu does not allow the use of inline styles.

For example, if you have some HTML as follows:

<div style="width:20px; background-color: #CCCCCC;"> Content Here </div>

Kupu replaces it with:

<div>Content Here</div>

The current method to allow inline style elements such as “width” and “background-color” require you to manually enter it in the Style Whitelist in Kupu’s preferences. However, if you want to allow the use of all inline styles you need to modify kupucontentfilters.js

In the ZMI, go to your Plone Instance. Customize the file /portal_skins/kupu/kupucontentfilters.js and remove the following function call:

if (val) {var styles = val.split(/; */);for (var i = styles.length; i >= 0; i—) if (styles[i]) {var parts = /^([^:]+): (.)$/.exec(styles[i]);var name = parts1.toLowerCase();if (validation.styleWhitelist[name]) {styles[i] = name+’: ’+parts2;} else {styles.splice(i,1); // delete}}if (styles[styles.length-1]) styles.push(’’);val = styles.join(’; ’).strip();}