alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class RichTextEditorCodeBlockSettings

    A class used for configuring the code block settings in the SfRichTextEditor. This allows customization of the available languages and default language for the code block feature inside the editor.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    RichTextEditorCodeBlockSettings
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    Namespace: Syncfusion.Blazor.RichTextEditor
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class RichTextEditorCodeBlockSettings : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

    Constructors

    RichTextEditorCodeBlockSettings()

    Declaration
    public RichTextEditorCodeBlockSettings()

    Properties

    DefaultLanguage

    Gets or sets the default programming language for new code blocks in the Rich Text Editor.

    Declaration
    [Parameter]
    public string? DefaultLanguage { get; set; }
    Property Value
    Type Description
    string

    A string specifying the language identifier (e.g., "plain text", "javascript"). The default value is "plain text".

    Remarks

    This property determines which language will be preselected when adding a new code block. The specified default language should match an entry in the Languages list for optimal user experience.

    Examples

    This example demonstrates how to set the DefaultLanguage property:

    <SfRichTextEditor>
        <RichTextEditorCodeBlockSettings DefaultLanguage="python" />
    </SfRichTextEditor>

    Languages

    Gets or sets the list of available programming languages for code blocks in the Rich Text Editor.

    Declaration
    [Parameter]
    public List<CodeBlockLanguageModel>? Languages { get; set; }
    Property Value
    Type Description
    List<CodeBlockLanguageModel>

    A List<T> representing the available languages displayed in the code block language selection dropdown.

    Remarks

    Each CodeBlockLanguageModel should specify the label (display name) and the language identifier (e.g., "C", "HTML", "typescript").

    Examples

    This example demonstrates how to configure the Languages property:

    <SfRichTextEditor>
        <RichTextEditorCodeBlockSettings Languages="@customLanguages" />
    </SfRichTextEditor>
    @code {
        private List<CodeBlockLanguageModel> customLanguages = new List<CodeBlockLanguageModel>
        {
            new CodeBlockLanguageModel { Label = "C#", Language = "csharp" },
            new CodeBlockLanguageModel { Label = "JavaScript", Language = "javascript" },
            new CodeBlockLanguageModel { Label = "Python", Language = "python" }
        };
    }

    Methods

    Dispose(bool)

    Dispose unmanaged resources in the Syncfusion Blazor component.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    Boolean value to dispose the object.

    Overrides
    OwningComponentBase.Dispose(bool)

    OnInitializedAsync()

    Method invoked when the component is initially initialized.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Overrides
    ComponentBase.OnInitializedAsync()

    OnParametersSetAsync()

    Method invoked when the component has received parameters from its parent.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    ComponentBase.OnParametersSetAsync()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved