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
Inheritance
Namespace: Syncfusion.Blazor.RichTextEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfRichTextEditor : SfBaseComponent
Constructors
SfRichTextEditor()
Declaration
public SfRichTextEditor()
Properties
AutoSaveOnIdle
Enables or disables the auto-save option which performs the save action while in the idle state after typed content.
If enabled, the Rich Text Editor will save the content on the idle state with SaveInterval
property's value.
Declaration
public bool AutoSaveOnIdle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ChildContent
Sets the child content for the Rich Text Editor Element.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment |
CssClass
Specifies the CSS class name that append with the root element of the Rich Text Editor. One or more custom CSS classes can be added to the Rich Text Editor.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String |
EditorMode
Defines the types of editor mode in which the Rich Text Editor is rendered.
Declaration
public EditorMode EditorMode { get; set; }
Property Value
Type | Description |
---|---|
EditorMode |
EnableAutoUrl
The given URL will automatically convert to the absolute path URL by prefixing https://
to hyperlinks.
Declaration
public bool EnableAutoUrl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Enabled
Specifies a value that indicates whether the component is enabled or not.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableHtmlEncode
Specifies the value that indicates whether the source code is displayed with the encoded format or not.
Declaration
public bool EnableHtmlEncode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableHtmlSanitizer
Defines whether to allow the cross-scripting site or not.
Declaration
public bool EnableHtmlSanitizer { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnablePersistence
Enables or disables the persisting component's state between page reloads. If enabled, the value of Rich Text Editor is persisted
Declaration
public bool EnablePersistence { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableResize
Enables or disables the resizing option in the editor. If enabled, the Rich Text Editor can be resized by dragging the resize icon in the bottom right corner.
Declaration
public bool EnableResize { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableRtl
Enable or disable the rendering component in the right to left direction.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableTabKey
Determines whether the Tab key action works within a content or not in the Rich Text Editor content.
Declaration
public bool EnableTabKey { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EnableXhtml
Enables to validate the Rich Text Editor’s content as valid XHTML format and resave it in the Editor’s content. To get valid XHTML format of content, use the public method “GetXhtml”.
Declaration
public bool EnableXhtml { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
FloatingToolbarOffset
Preserves the toolbar at the top of the Rich Text Editor on scrolling and specifies the offset of the floating toolbar from the documents top position.
Declaration
public double FloatingToolbarOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Height
Specifies the height of the Rich Text Editor component.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ID
Specifies the unique identifier
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MaxLength
Specifies the maximum number of characters allowed in the Rich Text Editor component.
Declaration
public int MaxLength { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Placeholder
Specifies the placeholder text to display when the Rich Text Editor's body is empty.
Declaration
public string Placeholder { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Readonly
The user interactions on the component are disabled when set to true.
Declaration
public bool Readonly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RichTextEditorParent
Declaration
protected dynamic RichTextEditorParent { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
RteEditContext
Declaration
protected EditContext RteEditContext { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.Forms.EditContext |
SaveInterval
Specifies the SaveInterval in milliseconds for autosave the value. 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 |
ShowCharCount
Sets a value that show or hide the character counter in the editor.
Declaration
public bool ShowCharCount { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
UndoRedoSteps
Specifies the count of undo history which is stored in the UndoRedoManager.
Declaration
public int UndoRedoSteps { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
UndoRedoTimer
Specifies the interval value in milliseconds that store actions in UndoRedoManager. The minimum value is 300 milliseconds.
Declaration
public int UndoRedoTimer { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Value
Specifies the value of the Rich Text Editor.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ValueChanged
Declaration
public EventCallback<string> ValueChanged { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.String> |
ValueExpression
Declaration
public Expression<Func<string>> ValueExpression { get; set; }
Property Value
Type | Description |
---|---|
System.Linq.Expressions.Expression<System.Func<System.String>> |
Width
Specifies the width of the Rich Text Editor.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
DisableToolbarItem(List<ToolbarCommand>)
Disables the given toolbar items in the Rich Text Editor 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. |
EnableToolbarItem(List<ToolbarCommand>)
Enables the given toolbar items in the Rich Text Editor 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. |
ExecuteCommand(CommandName)
Executes the commands.
Declaration
public Task ExecuteCommand(CommandName commandName)
Parameters
Type | Name | Description |
---|---|---|
CommandName | commandName | Specifies the name of the command to be executed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ExecuteCommand(CommandName, ImageCommandsArgs, ExecuteCommandOption)
Executes the commands related to Image.
Declaration
public Task ExecuteCommand(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 the values like Url ,Width, Height, AltText and CssClass of the image. |
ExecuteCommandOption | option | Specifies other options to be given when execution. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ExecuteCommand(CommandName, LinkCommandsArgs, ExecuteCommandOption)
Executes the commands related to Link.
Declaration
public Task ExecuteCommand(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 the values like Url ,Title, Text and Target of the link. |
ExecuteCommandOption | option | Specifies other options to be given when execution. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ExecuteCommand(CommandName, TableCommandsArgs, ExecuteCommandOption)
Executes the commands related to Table.
Declaration
public Task ExecuteCommand(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 the values like Rows ,Columns and Width of the table. |
ExecuteCommandOption | option | Specifies other options to be given when execution. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ExecuteCommand(CommandName, String, ExecuteCommandOption)
Executes the commands
Declaration
public Task ExecuteCommand(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 other options to be given when execution. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
FocusIn()
Focuses the Rich Text Editor component.
Declaration
public Task FocusIn()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
FocusOut()
Blurs the Rich Text Editor component.
Declaration
public Task FocusOut()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
GetCharCount()
Returns the maximum number of characters in the Rich Text Editor.
Declaration
public Task<double> GetCharCount()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Double> |
GetSelectedHtml()
Returns the HTML value of the selected content as a string.
Declaration
public Task<string> GetSelectedHtml()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
GetSelection()
Retrieves the HTML markup content from currently selected content of Rich Text Editor.
Declaration
public Task<string> GetSelection()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
GetText()
Returns the plain-text content of the editor’s value.
Declaration
public Task<string> GetText()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
GetXhtml()
Retrieves the Rich Text Editor's XHTML validated HTML content when enableXhtml
property is enabled.
Declaration
public Task<string> GetXhtml()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> |
HideInlineToolbar()
Hides the inline quick toolbar.
Declaration
public Task HideInlineToolbar()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
OnParametersSetAsync()
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Print()
Prints the Rich Text Editor’s value.
Declaration
public Task Print()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RefreshUI()
Refresh the view of the editor.
Declaration
public Task RefreshUI()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RemoveToolbarItem(List<ToolbarCommand>)
Removes the given toolbar items from the Rich Text Editor 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. |
RestoreSelection()
Restore the saved selection in the Rich Text Editor content.
Declaration
public Task RestoreSelection()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SaveSelection()
Save the current selection in the Rich Text Editor content.
Declaration
public Task SaveSelection()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SelectAll()
Selects all the content in Rich Text Editor.
Declaration
public Task SelectAll()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ShowFullScreen()
Shows the Rich Text Editor component in full-screen mode.
Declaration
public Task ShowFullScreen()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ShowInlineToolbar()
Shows the inline quick toolbar.
Declaration
public Task ShowInlineToolbar()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ShowSourceCode()
Shows the HTML and Markdown markup of the Rich Text Editor’s value.
Declaration
public Task ShowSourceCode()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |