Blazor Rich Text Editor Example - Paste Cleanup
This example demonstrates the paste options in Rich Text Editor control. The Blazor Rich Text Editor offers built-in option to paste content from Microsoft Word, Microsoft Outlook, Microsoft Excel and other websites by filtering out tags, attributes, and styles. Copy content from Microsoft Office or other website and paste it into the editor, where it is cleaned up and pasted based on the settings in the properties panel.
Format Option |
|
Denied Tags |
|
Denied Attributes |
|
Allowed Style Properties |
The Rich Text Editor allows to paste the HTML content from Microsoft Word, Microsoft Outlook, Microsoft Excel and other websites. The editor cleanup (filters tags, attributes, and styles) the pasted HTML content as follows,
- The unformatted HTML element (MOS XML format) content to standard HTML elements.
- The Microsoft 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 Rich Text Editor cleanup (filters tags, attributes, and styles) the pasted content based on properties of RichTextEditorPasteCleanupSettings.
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.