Example of Paste from MS Word in Javascript Rich Text Editor Control

Paste from MS Word

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.

More Details...

RichTextEditor is a WYSIWYG editing control which will reduce the effort for users while trying to express their formatting word content as HTML or Markdown format.

Paste Cleanup properties:

  • prompt - specifies whether to enable the prompt when pasting in RichTextEditor.

  • plainText - specifies whether to paste as plain text or not in RichTextEditor.

  • keepFormat- specifies whether to keep or remove the format when pasting in RichTextEditor.

  • deniedTags - specifies the tags to restrict when pasting in RichTextEditor.

  • deniedAttributes - specifies the attributes to restrict when pasting in RichTextEditor.

  • allowedStyleProperties - specifies the allowed style properties when pasting in RichTextEditor.

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 Option drop down list for the paste content. Select the Prompt option to invoke prompt dialog with paste options on pasting the content in editor. Select the Plain Text option to paste the content as plain text. Select the Keep Format option to keep the same format in the copied content. Select the Clean Format option to remove the style format in the copied content. Fill the denied tags text 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 attributes to 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 properties to 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. Injecting Module 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, Count, HtmlEditor, PasteCleanup) to use the paste cleanup feature.