Class BlockEditorPasteCleanup
Gets or sets the settings related to paste operations in the editor.
Inherited Members
Namespace: Syncfusion.Blazor.BlockEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class BlockEditorPasteCleanup : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
This can be used to strip styles, sanitize pasted HTML, or control allowed elements.
Constructors
BlockEditorPasteCleanup()
Declaration
public BlockEditorPasteCleanup()
Properties
AllowedStyles
Specifies the list of allowed CSS styles when pasting content.
Declaration
[Parameter]
public string[] AllowedStyles { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] | A string array containing the names of CSS properties to retain from pasted content. |
Remarks
Only the styles listed in this property will be preserved; all others will be removed. For example: "color", "font-weight".
Examples
AllowedStyles = new[] { "color", "font-weight", "font-style" };
DeniedAttributes
Specifies the list of denied attributes that should be removed from pasted content.
Declaration
[Parameter]
public string[] DeniedAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] | A string array of HTML attribute names that should be stripped. Examples include |
Remarks
Attributes listed here will be removed from all elements during paste cleanup.
Examples
DeniedAttributes = new[] { "style", "onclick", "onmouseover" };
DeniedTags
Specifies the list of denied HTML tags that should be removed when pasting content.
Declaration
[Parameter]
public string[] DeniedTags { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] | A string array of HTML tag names to be removed during paste processing. Example: |
Remarks
Any tag specified will be stripped entirely from the pasted content.
Examples
DeniedTags = new[] { "script", "iframe", "style" };
KeepFormat
Specifies whether to retain formatting from the pasted content.
Declaration
[Parameter]
public bool KeepFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A boolean value indicating whether styles like bold, italic, or headings are preserved. The default is |
Remarks
If both PlainText and KeepFormat are set to true, PlainText takes precedence and formatting will be stripped.
PlainText
Specifies whether the pasted content should be plain text.
Declaration
[Parameter]
public bool PlainText { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A boolean value indicating if all formatting should be removed from pasted content. The default is |
Remarks
When set to true, all HTML tags and styles will be stripped, resulting in raw text only.
Methods
Dispose(bool)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Overrides
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
| Type |
|---|
| Task |