This example demonstrates the paste cleanup feature of the Rich Text Editor control. Copy your content from MS Word or other website, and paste it within the editor to cleanup.
The Rich Text Editor allows to paste the HTML content from MS Word or other websites. The editor cleanup the pasted HTML content by considering the following items.
The following settings are available to cleanup the content in pasteCleanup settings property:
Format Optiondrop down list for the paste content.
Promptoption to invoke prompt dialog with paste options on pasting the content in editor.
Plain Textoption to paste the content as plain text.
Keep Formatoption to keep the same format in the copied content.
Clean Formatoption to remove the style format in the copied content.
denied tagstext box to ignore the tags when pasting HTML content. For example:
['a[!href]']- paste the content by filtering anchor tags that don’t have the 'href' attribute.
['a[href, target]']- paste the content by filtering anchor tags that have the 'href' and 'target' attributes.
denied attributesto paste the content by filtering out these attributes from the content. For example:
['id', 'title']- This will remove the attributes 'id' and 'title' from all tags.
allowed style propertiesto paste the content by accepting these style attributes and removing other attributes. For example:
['color', 'margin']- This will allow only the style properties 'color' and 'margin' in each pasted element.
The previous features were built as modules to be included in your application. For example, inject the
'PasteCleanup' module using
RichTextEditor.Inject (Toolbar, Link, Image, QuickToolbar, Count, HtmlEditor, PasteCleanup) to use the paste cleanup feature.