Clipboard Clean-up in Blazor Rich Text Editor
18 Nov 20181 minute to read
The Rich Text Editor now provides automatic cleanup of clipboard content during copy (Ctrl + C) and cut (Ctrl + X) operations. When this feature is enabled, unwanted inline styles are removed while preserving important structural elements such as tables, lists, and images. This feature is enabled by default through EnableClipboardCleanup property.
It can be verified by following the below steps:
- Copy or cut content within the Rich Text Editor.
- Paste the content back into the editor.
- Observe that unnecessary inline styles are removed while essential elements such as tables, lists, and images remain intact.
By default, EnableClipboardCleanup is set to true. Check with the below demonstration:
@using Syncfusion.Blazor.RichTextEditor
<SfRichTextEditor>
<h3>Clipboard Cleanup – Default Behavior</h3>
<p>The Rich Text Editor automatically cleans up clipboard content during copy and cut operations to ensure clean formatting.</p>
<p><b>Key Features:</b></p>
<ul>
<li>Removes unwanted inline styles from copied or cut content.</li>
<li>Preserves essential elements like tables, lists, and images.</li>
</ul>
</SfRichTextEditor>
When set to false, the browser’s default copy and cut behavior applies. Check with the below demonstration:
@using Syncfusion.Blazor.RichTextEditor
<SfRichTextEditor EnableClipboardCleanup="false">
<h3>Clipboard Cleanup Disabled</h3>
<p>The Rich Text Editor uses the browser’s default copy and cut behavior when clipboard cleanup is disabled.</p>
<p><b>Key Points:</b></p>
<ul>
<li>No cleanup is applied; original styles remain intact.</li>
<li>Content is copied exactly as it appears in the editor.</li>
</ul>
</SfRichTextEditor>