Example of Paste from MS Word in ASP.NET MVC Rich Text Editor Control
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.
DEMO
SOURCE
|
Format Option
|
|
|
Denied Tags
|
|
|
Denied Attributes
|
|
|
Allowed Style Properties
|
|
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 unformatted HTML element (MOS XML format) content to standard HTML elements.
- The MS Office prefixed style properties is converted to proper CSS style properties.
- The unwanted tags, CSS styles, and comments are removed from the copied content.
The following settings are available to cleanup the content in pasteCleanup settings property:
- Select any option in
Format Optiondrop down list for the paste content.- Select the
Promptoption to invoke prompt dialog with paste options on pasting the content in editor. - Select the
Plain Textoption to paste the content as plain text. - Select the
Keep Formatoption to keep the same format in the copied content. - Select the
Clean Formatoption to remove the style format in the copied content.
- Select the
- Fill the
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.
- Fill the
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.
- Fill the
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.