Cleaning up Pasted Content
Content copied from external sources such as web pages can contain a lot of unwanted and potentially dangerous markup. CUE therefore filters all content pasted into the rich text editor, removing everything except a small subset of HTML formats that are considered to be both useful and harmless. CUE's has two whitelists of allowed formats: a very restrictive one for print stories:
b i u sub sup p br ul ol li table thead tbody tfoot tr th td
and a slightly less restrictive one for online stories that includes headings, images and links:
h1 h2 h3 h4 h5 h6 b i u sub sup p br a[href] a[target] a[rel] ul ol li img[src] img[alt] img[width] img[height] table thead tbody tfoot tr th td
The print whitelist is fixed, but you can override the online
whitelist for a rich text fields by adding a
ui:whitelisted-elements-onpaste
element to the
field definition in your publication's content-type
resource. The ui:whitelisted-elements-onpaste
element must be added as a child of the field
element. If you want to change the whitelist of all the rich text
fields in your publication then you must add a
ui:whitelisted-elements-onpaste
element to all the
rich text field
elements in your content-type
resource.
Here is an example whitelist definition that is more restrictive than the default online whitelist:
<ui:whitelisted-elements-onpaste> h1 h2 h3 b i p br a[href] a[target] a[rel] a[class=myclass] </ui:whitelisted-elements-onpaste>
For further information about the
ui:whitelisted-elements-onpaste
element, see
here.