Allow all inline styles in Kupu
This How-to applies to:
Plone 3.0.x, Plone 2.5.x, Plone 2.1.x
This How-to is intended for:
Site Administrators
By default, Kupu does not allow the use of inline styles unless they are specified in the Style Whitelist.
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 = parts[1].toLowerCase();
if (validation.styleWhitelist[name]) {
styles[i] = name+': '+parts[2];
} else {
styles.splice(i,1); // delete
}
}
if (styles[styles.length-1]) styles.push('');
val = styles.join('; ').strip();
}
see also:
-
HTML Filtering options
- A discussion of the main way Plone filters HTML.
-
Resizing images in Kupu
- How to enable image resizing in Kupu editor