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...

Paste Cleanup in Rich Text Editor

The Rich Text Editor automatically cleans up formatted content when you paste from external sources like Word, Google Docs, or web pages.

Paste Cleanup properties:

  • Prompt - specifies whether to enable the prompt when pasting in Rich Text Editor
  • Plain Text - specifies whether to paste as plain text or not in Rich Text Editor.
  • Keep Format - specifies whether to keep or remove the format when pasting in Rich Text Editor.
  • Denied Tags - specifies the tags to restrict when pasting in Rich Text Editor.
  • Denied Attributes - specifies the attributes to restrict when pasting in Rich Text Editor.
  • Allowed Style Properties - specifies the allowed style properties when pasting in Rich Text Editor.

Try It Out!

Copy content from a web page or document and paste it here. The editor will display a prompt and allow you to input your options.

Format Option
Denied Tags
Denied Attributes
Allowed Style Properties
Description

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, HtmlEditor, QuickToolbar, PasteCleanup, Table) to use the paste cleanup feature.