Personal tools
You are here: Home Documentation How-tos Allow all inline styles in Kupu
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

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

How to disable Kupu's filtering of all inline styles

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
by mtakahashi — last modified April 24, 2008 - 15:25
Contributors: Duncan Booth
All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by