Class SfRichTextEditor
The Blazor Rich Text Editor is a feature-rich WYSIWYG HTML editor and WYSIWYG Markdown editor. The Rich Text Editor is widely used to create blogs, forum posts, notes sections, support tickets (incidents), comment sections, messaging applications, and more.
Inherited Members
Namespace: Syncfusion.Blazor.RichTextEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfRichTextEditor : SfBaseComponent
Constructors
SfRichTextEditor()
Declaration
public SfRichTextEditor()
Properties
AdditionalSanitizeAttributes
Gets or sets a list of SanitizeAttribute objects to specify which attributes to remove from the selected elements, enhancing content security.
Declaration
public List<SanitizeAttribute> AdditionalSanitizeAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<SanitizeAttribute> | A list of SanitizeAttribute objects, each defining an attribute to be removed from elements that match the corresponding Selector. The default value is an empty list. |
Remarks
The AdditionalSanitizeAttributes
property allows for detailed customization of the content sanitization process in the Rich Text Editor.
By default, potentially dangerous tags and attributes are removed. Configuring the AdditionalSanitizeAttributes
property allows you to specify which attributes, defined by the Attribute property, should be removed from the elements identified by the Selector in the editor content.
Examples
This example demonstrates how to configure AdditionalSanitizeAttributes
for the Rich Text Editor:
<SfRichTextEditor EnableHtmlSanitizer="true" AdditionalSanitizeAttributes="@additionalSanitizeAttributes">
</SfRichTextEditor>
@code {
private List<SanitizeAttribute> additionalSanitizeAttributes = new List<SanitizeAttribute>
{
new SanitizeAttribute { Selector = "span", Attribute = "style" }
};
}
AdditionalSanitizeTags
Gets or sets a list of tags to be included in the sanitize list, preventing their insertion into the Rich Text Editor.
Declaration
public string[] AdditionalSanitizeTags { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | An array of string values representing the tags to be included in the sanitize list. The default value is an empty array. |
Remarks
The AdditionalSanitizeTags
property allows for detailed customization of the content sanitization process in the Rich Text Editor.
By default, potentially dangerous tags and attributes are removed. Configuring the AdditionalSanitizeTags
property specifies which tags should be removed from the editor content.
Examples
This example demonstrates how to configure AdditionalSanitizeTags
for the Rich Text Editor:
<SfRichTextEditor EnableHtmlSanitizer="true" AdditionalSanitizeTags="@additionalSanitizeTags">
</SfRichTextEditor>
@code {
private string[] additionalSanitizeTags = { "script" };
}
AutoSaveOnIdle
Gets or sets whether the content is saved if the editor is idle for the number of milliseconds specified in the SaveInterval property or not.
Declaration
public bool AutoSaveOnIdle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This feature minimizes data loss by automatically triggering save operations during inactivity.
See Also
ChildContent
Gets or sets the child content for the SfRichTextEditor component.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment | The template content. The default value is |
Remarks
This allows for embedding HTML markup as content within the component.
Examples
In this example, the content is set to the SfRichTextEditor using the ChildContent property.
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor>
<p> The Rich Text Editor component is a <b>WYSIWYG</b>("what you see is what you get") editor.</p>
</SfRichTextEditor>
CssClass
Gets or sets the CSS classes to customize the appearance of the SfRichTextEditor component. One or more custom CSS classes can be added.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string of CSS classes, separated by spaces, to customize editor appearance. Default is |
Remarks
Provides flexibility to style the Rich Text Editor according to your needs.
DeniedSanitizeSelectors
Gets or sets the list of selectors to be removed from the default sanitization list, allowing them in the editor.
Declaration
public string[] DeniedSanitizeSelectors { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | An array of string values. The default value is an empty array. |
Remarks
By default, certain selectors are sanitized from the Rich Text Editor content.
Configuring the DeniedSanitizeSelectors
property removes those items from the default list, effectively allowing them in the editor.
The default sanitization list includes the following selectors:
[
'script',
'iframe[src]',
'link[href*="javascript:"]',
'object[type="text/x-scriptlet"]',
'object[data^="data:text/html;base64"]',
'img[src^="data:text/html;base64"]',
'[src^="javascript:"]',
'[dynsrc^="javascript:"]',
'[lowsrc^="javascript:"]',
'[type^="application/x-shockwave-flash"]'
]
Examples
This example demonstrates how to configure the DeniedSanitizeSelectors
for the Rich Text Editor:
<SfRichTextEditor EnableHtmlSanitizer="true" DeniedSanitizeSelectors="@deniedSanitizeSelectors">
</SfRichTextEditor>
@code {
private string[] deniedSanitizeSelectors = { "iframe[src]", "script" };
}
EditorMode
Gets or sets a value indicating whether the SfRichTextEditor allows editing and formatting HTML or Markdown content.
Declaration
public EditorMode EditorMode { get; set; }
Property Value
Type | Description |
---|---|
EditorMode | A value from the EditorMode enumeration. The default value is HTML. |
Remarks
If the EditorMode
is HTML
, edit HTML markup content.
If the EditorMode
is Markdown
, edit the Markdown content with markdown syntax.
EnableAutoUrl
Gets or sets whether hyperlinks' URLs will automatically convert to absolute paths by prefixing https://
.
Declaration
public bool EnableAutoUrl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This feature simplifies providing complete and valid URL links within the editor content.
Enabled
Gets or sets whether the SfRichTextEditor component is enabled or not.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The enabled state allows control over the editor's interactivity with users.
EnableHtmlEncode
Gets or sets whether the source code is displayed in HTML encoded format or not.
Declaration
public bool EnableHtmlEncode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The encoding option applies only to the HTML editor, not to Markdown. This ensures that HTML content is safely rendered without executing any scripts.
EnableHtmlSanitizer
Gets or sets whether to allow cross-scripting site attacks or not.
Declaration
public bool EnableHtmlSanitizer { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enabling this ensures that the content in the editor is protected against cross-site scripting attacks.
EnablePersistence
Gets or sets whether to persist the component's state between page reloads. When set to true
, the Value property is saved and restored after a page reload.
Declaration
public bool EnablePersistence { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The component's Value property will be stored in the browser's local storage to maintain the component's state during reloads. This helps in retaining data integrity across browser sessions.
EnableResize
Gets or sets whether the Rich Text Editor content area allows resizing or not.
Declaration
public bool EnableResize { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enabling resizing offers increased flexibility in adjusting the visual layout of the editor to fit content needs.
EnableRtl
Gets or sets whether the right-to-left direction is enabled for the SfRichTextEditor component.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enabling RTL renders text from right to left, catering to languages like Arabic and Hebrew.
EnableTabKey
Gets or sets whether the Tab key action works within the editor content or not.
Declaration
public bool EnableTabKey { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enabling Tab key functionality allows adding tab spaces within the content, similar to word processors.
EnableXhtml
Gets or sets whether the editor's content is in valid XHTML format or not.
Declaration
public bool EnableXhtml { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Use the public method GetXhtmlAsync() to ensure content conforms to standard XHTML formatting.
EnterKey
Gets or sets a tag value that will be inserted when the ENTER key is pressed.
Declaration
public EnterKeyTag EnterKey { get; set; }
Property Value
Type | Description |
---|---|
EnterKeyTag | A value from the EnterKeyTag enumeration. The default value is P. |
Remarks
If the EnterKey
is EnterKeyTag.P
, a new <p> tag will be inserted when the ENTER key is pressed.
If the EnterKey
is EnterKeyTag.DIV
, a new <div> tag will be inserted when the ENTER key is pressed.
If the EnterKey
is EnterKeyTag.BR
, a new <br> tag will be inserted when the ENTER key is pressed.
See Also
FloatingToolbarOffset
Gets or sets the offset top value to preserve the toolbar of the SfRichTextEditor during scrolling.
Declaration
public double FloatingToolbarOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value that specifies the offset from the top. The default value is |
Remarks
This property adjusts the toolbar's vertical spacing, keeping it visible during scroll operations.
Height
Gets or sets the height of the SfRichTextEditor component.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value representing the height. The default value is |
Remarks
Specify the height in pixels or percentage (%) as a string to adjust the editor's vertical size.
ID
Gets or sets the unique identifier for the SfRichTextEditor component.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the unique identifier. The default value is |
Remarks
Ensure to specify a unique value for the component ID.
KeyConfigure
Gets or sets the keyboard shortcuts key configuration in the SfRichTextEditor.
Declaration
public ShortcutKeys KeyConfigure { get; set; }
Property Value
Type | Description |
---|---|
ShortcutKeys | A ShortcutKeys configuration. |
Remarks
Allows customization of keyboard shortcuts to enhance productivity in content editing.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor KeyConfigure="shortcutKeys">
</SfRichTextEditor>
@code {
ShortcutKeys shortcutKeys = new ShortcutKeys() { Bold = "ctrl+d" };
}
MaxLength
Gets or sets the maximum number of characters allowed to be typed in the SfRichTextEditor component.
Declaration
public int MaxLength { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | An integer representing the character limit. Default value is |
Remarks
While copying and pasting content into the editor, only MaxLength characters are allowed, and any excess characters will be truncated.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor MaxLength="200" ShowCharCount=true>
</SfRichTextEditor>
Placeholder
Gets or sets the text displayed when the component has no content and is removed on focus.
Declaration
public string Placeholder { get; set; }
Property Value
Type | Description |
---|---|
System.String | The text displayed when the SfRichTextEditor component has no content. The default value is |
Remarks
This property provides user guidance by showing a placeholder message.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor Placeholder="Start to type...">
</SfRichTextEditor>
Readonly
Gets or sets a value indicating whether content in the SfRichTextEditor component is read-only.
Declaration
public bool Readonly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When this property is set to true
, the content of the component cannot be changed through user interaction. However, you can set the value of the Value property programmatically.
SaveInterval
Gets or sets the interval time in milliseconds for automatically making a save request after a specified duration of inactivity. The change event will be triggered if the content was changed from the last saved interval.
Declaration
public double SaveInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The number of milliseconds for the interval time. The default is |
Remarks
The ValueChange event will be triggered with each save request if the content was modified since the last saved interval. Automatically saving at regular intervals minimizes the risk of content loss due to unexpected interruptions.
See Also
ShiftEnterKey
Gets or sets a tag value that will be inserted when the SHIFT + ENTER keys are pressed.
Declaration
public ShiftEnterKeyTag ShiftEnterKey { get; set; }
Property Value
Type | Description |
---|---|
ShiftEnterKeyTag | A value from the ShiftEnterKeyTag enumeration. The default value is BR. |
Remarks
If the ShiftEnterKey
is ShiftEnterKeyTag.BR
, a new <br> tag will be inserted when SHIFT + ENTER key is pressed.
If the ShiftEnterKey
is ShiftEnterKeyTag.P
, a new <p> tag will be inserted when SHIFT + ENTER key is pressed.
If the ShiftEnterKey
is ShiftEnterKeyTag.DIV
, a new <div> tag will be inserted when SHIFT + ENTER key is pressed.
See Also
ShowCharCount
Gets or sets a value indicating whether to show or hide the character counter at the bottom of the editor.
Declaration
public bool ShowCharCount { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The character counter helps users maintain content length constraints.
See Also
ShowTooltip
Gets or sets whether tooltips will be displayed for the Rich Text Editor toolbar.
Declaration
public bool ShowTooltip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Tooltips provide additional context for toolbar options, improving usability.
UndoRedoSteps
Gets or sets the number of undo and redo history steps to store in the undo and redo stack.
Declaration
public int UndoRedoSteps { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of steps to be stored in the undo and redo stack. The default value is |
Remarks
This property allows for configuring the depth of changes tracked for undo/redo functionality.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor UndoRedoSteps="50">
</SfRichTextEditor>
UndoRedoTimer
Gets or sets the idle time in milliseconds that is stored in the undo stack after stopping typing in the editor.
Declaration
public int UndoRedoTimer { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of milliseconds for idle time stored in the undo stack after stopping typing in the editor. The default is |
Remarks
This setting defines how often changes are captured in the undo history while typing.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor UndoRedoTimer="100">
</SfRichTextEditor>
Value
Gets or sets the current content of the Rich Text Editor.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | The string content displayed in the Rich Text Editor component. |
Remarks
This property controls the text content currently displayed and edited within the Rich Text Editor.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor @bind-Value="rteValue">
</SfRichTextEditor>
@code {
string rteValue = "<p> The Rich Text Editor component is a <b>WYSIWYG</b>('what you see is what you get') editor.</p>";
}
ValueChanged
Declaration
public EventCallback<string> ValueChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.String> |
ValueExpression
Declaration
public Expression<Func<string>> ValueExpression { get; set; }
Property Value
Type |
---|
System.Linq.Expressions.Expression<System.Func<System.String>> |
Width
Gets or sets the width of the Rich Text Editor.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | The string representing the width in pixels or percent (%). The default value is |
Remarks
Specifies the horizontal dimension, allowing resizing according to layout needs.
Examples
@using Syncfusion.Blazor.RichTextEditor;
<SfRichTextEditor Width="50%">
</SfRichTextEditor>
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
CloseDialogAsync(DialogType)
Closes the specified dialog in the Rich Text Editor component.
Declaration
public Task CloseDialogAsync(DialogType type)
Parameters
Type | Name | Description |
---|---|---|
DialogType | type | Specifies the type of dialog to be closed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Remarks
Closes dialogs associated with various insert operations such as Link, Image, Audio, and Video.
DisableToolbarItem(List<ToolbarCommand>)
Disables the given toolbar items in the SfRichTextEditor component.
Declaration
public void DisableToolbarItem(List<ToolbarCommand> items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ToolbarCommand> | items | Specifies the list of toolbar items to be disabled. |
Remarks
This method alters the interactive state of specified toolbar items, preventing their use.
EnableToolbarItem(List<ToolbarCommand>)
Enables the specified toolbar items in the SfRichTextEditor component.
Declaration
public void EnableToolbarItem(List<ToolbarCommand> items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ToolbarCommand> | items | Specifies the list of toolbar items to be enabled. |
Remarks
This method enables the specified toolbar items, making them interactive for the user. It does not return a value.
ExecuteCommandAsync(CommandName)
Executes the specified command asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Executes editor commands such as formatting, alignment, etc.
ExecuteCommandAsync(CommandName, AudioCommandsArgs, ExecuteCommandOption)
Executes audio-related commands asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName, AudioCommandsArgs commandValue = null, ExecuteCommandOption option = null)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
AudioCommandsArgs | commandValue | Specifies values such as Url and CssClass of the audio. |
ExecuteCommandOption | option | Specifies additional execution options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Executes commands for managing audio content including inserting and styling audio elements.
ExecuteCommandAsync(CommandName, ImageCommandsArgs, ExecuteCommandOption)
Executes image-related commands asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName, ImageCommandsArgs commandValue = null, ExecuteCommandOption option = null)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
ImageCommandsArgs | commandValue | Specifies values such as Url, Width, Height, AltText, and CssClass of the image. |
ExecuteCommandOption | option | Specifies additional execution options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Allows execution of image commands like inserting an image and adjusting its properties.
ExecuteCommandAsync(CommandName, LinkCommandsArgs, ExecuteCommandOption)
Executes link-related commands asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName, LinkCommandsArgs commandValue = null, ExecuteCommandOption option = null)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
LinkCommandsArgs | commandValue | Specifies values like Url, Title, Text, and Target of the link. |
ExecuteCommandOption | option | Specifies additional execution options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Utilizes commands for link operations like creating, customizing, and managing link elements in the editor.
ExecuteCommandAsync(CommandName, TableCommandsArgs, ExecuteCommandOption)
Executes table-related commands asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName, TableCommandsArgs commandValue = null, ExecuteCommandOption option = null)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
TableCommandsArgs | commandValue | Specifies values like Rows, Columns, and Width of the table. |
ExecuteCommandOption | option | Specifies additional execution options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Allows execution of table commands such as inserting or modifying tables.
ExecuteCommandAsync(CommandName, VideoCommandsArgs, ExecuteCommandOption)
Executes video-related commands asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName, VideoCommandsArgs commandValue = null, ExecuteCommandOption option = null)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
VideoCommandsArgs | commandValue | Specifies values like Url, Width, Height, and CssClass of the video. |
ExecuteCommandOption | option | Specifies additional execution options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Facilitates execution of video commands such as inserting and configuring video settings in the editor.
ExecuteCommandAsync(CommandName, String, ExecuteCommandOption)
Executes the specified command with additional options asynchronously.
Declaration
public Task ExecuteCommandAsync(CommandName commandName, string commandValue = null, ExecuteCommandOption option = null)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
System.String | commandValue | Specifies the value to be applied or inserted when executing the command. |
ExecuteCommandOption | option | Specifies additional execution options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Allows command execution with customizable parameters,.
FocusAsync()
Focuses the SfRichTextEditor component.
Declaration
public Task FocusAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Sets the focus on the editor, enabling user interaction.
FocusOutAsync()
Blurs the SfRichTextEditor component.
Declaration
public Task FocusOutAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Removes the focus from the editor, effectively blurring the input area.
GetCharCountAsync()
Retrieves the number of characters in the SfRichTextEditor.
Declaration
public Task<double> GetCharCountAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Double> | Returns a System.Threading.Tasks.Task representing the asynchronous operation, containing the character count as a System.Double. |
Remarks
Provides a character count, aiding in ensuring content adheres to length restrictions or guidelines.
GetSelectedHtmlAsync()
Gets the HTML value of the selected content as a string.
Declaration
public Task<string> GetSelectedHtmlAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | Returns a System.Threading.Tasks.Task representing the asynchronous operation, containing the selected HTML as a System.String. |
Remarks
This method retrieves the currently selected HTML content for further manipulation or inspection.
GetSelectionAsync()
Retrieves the HTML markup content from the currently selected content of the SfRichTextEditor.
Declaration
public Task<string> GetSelectionAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | Returns a System.Threading.Tasks.Task representing the asynchronous operation, containing the selected HTML as a System.String. |
Remarks
Provides HTML markup of the selection for processing or storage purposes.
GetTextAsync()
Gets the plain-text content of the editor’s value.
Declaration
public Task<string> GetTextAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | Returns a System.Threading.Tasks.Task representing the asynchronous operation, containing the plain text as a System.String. |
Remarks
Retrieve the non-HTML raw text content from the editor for evaluation or usage elsewhere.
GetXhtmlAsync()
Retrieves the Rich Text Editor's XHTML validated HTML content when EnableXhtml property is enabled.
Declaration
public Task<string> GetXhtmlAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | A System.Threading.Tasks.Task representing the asynchronous operation, with the XHTML content as a System.String. |
Remarks
Use this function to obtain well-formed XHTML content for applications that require strict XML compliance.
HideInlineToolbarAsync()
Hides the inline quick toolbar.
Declaration
public Task HideInlineToolbarAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method hides the inline toolbar, providing a cleaner editor view when not required for editing.
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Overrides
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
PreventRender(Boolean)
Determines whether the Rich Text Editor in the page should be re-rendered. This method will internally sets value to be returned from ShouldRender() method. The method helps to manage the UI refreshing.
Declaration
public void PreventRender(bool preventRender = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | preventRender | Default value is true. Toggles the ShouldRender() method value. |
PrintAsync()
Prints the Rich Text Editor’s value.
Declaration
public Task PrintAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Sends the current content of the Rich Text Editor to the print queue, facilitating printing from the application.
RefreshUIAsync()
Refreshes the view of the editor.
Declaration
public Task RefreshUIAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Updates the UI to reflect any structural changes and refreshes toolbar configurations if applicable.
RemoveToolbarItem(List<ToolbarCommand>)
Removes the specified toolbar items from the SfRichTextEditor component.
Declaration
public void RemoveToolbarItem(List<ToolbarCommand> items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ToolbarCommand> | items | Specifies the list of toolbar items to be removed. |
Remarks
Deletes designated toolbar items, streamlining the toolbar's interface by removing unnecessary functions.
RestoreSelectionAsync()
Restores the saved selection range in the SfRichTextEditor content.
Declaration
public Task RestoreSelectionAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Reapplies the saved selection, enabling users to continue editing or operations on the resumed selection.
SaveSelectionAsync()
Saves the current selection range in the SfRichTextEditor content.
Declaration
public Task SaveSelectionAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Preserves the current selection state, allowing users to move or reload content without losing selected text.
SelectAllAsync()
Selects all the content in the editor.
Declaration
public Task SelectAllAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Allows users to easily select all editable content for copying, cutting, or formatting.
ShouldRender()
Declaration
protected override bool ShouldRender()
Returns
Type |
---|
System.Boolean |
ShowDialogAsync(DialogType)
Shows the dialog in the SfRichTextEditor component.
Declaration
public Task ShowDialogAsync(DialogType type)
Parameters
Type | Name | Description |
---|---|---|
DialogType | type | Specifies the dialog name to be opened. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Opens the specified dialog box within the editor for operations such as inserting links, images, tables, and more.
ShowFullScreenAsync()
Displays the SfRichTextEditor component in full-screen mode.
Declaration
public Task ShowFullScreenAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Expands the editor to occupy the full screen, enhancing the user's focus and visibility of content.
ShowInlineToolbarAsync()
Shows the inline quick toolbar.
Declaration
public Task ShowInlineToolbarAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Brings the inline toolbar into view, offering quick access to frequently used editing options.
ShowSourceCodeAsync()
Shows the HTML and Markdown markup of the Rich Text Editor’s value.
Declaration
public Task ShowSourceCodeAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Allows users to view and edit the underlying source code for content in both HTML and Markdown formats.