alexa
menu

Blazor

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

    Show / Hide Table of Contents

    Class RichTextEditorImageSettings

    A class used for configuring the image inserting settings in the SfRichTextEditor. This class provides properties to control how images are inserted, displayed, and manipulated within the editor.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    RichTextEditorImageSettings
    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.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    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 RichTextEditorImageSettings : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

    Constructors

    RichTextEditorImageSettings()

    Declaration
    public RichTextEditorImageSettings()

    Properties

    AllowedTypes

    Gets or sets image extensions that populate the allowed types of images on browse.

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

    The list of image types that are allowed to be uploaded. The default values are jpeg, jpg, and png.

    Remarks

    Specifies which image file extensions are permitted for upload. This helps in restricting file types to a specific set of valid formats.

    Examples

    The following code example allows uploading only for JPEG and JPG image types.

    @using Syncfusion.Blazor.RichTextEditor;
    <SfRichTextEditor>
        <RichTextEditorToolbarSettings Items = "@Tools" />
        <RichTextEditorImageSettings AllowedTypes="@TypeList" />
    </SfRichTextEditor>
    @code {
        List<string> TypeList = new List<string>() { ".jpeg", ".jpg" };
        private List<ToolbarItemModel> Tools = new List<ToolbarItemModel>()
        {
            new ToolbarItemModel() { Command = ToolbarCommand.Image }
        };
    }

    Display

    Gets or sets whether the inserted image is displayed as Inline or Break.

    Declaration
    [Parameter]
    public ImageDisplay Display { get; set; }
    Property Value
    Type Description
    ImageDisplay

    A value from the ImageDisplay enumeration. The default value is Inline.

    EnableResize

    Determines whether the image element can be resized in the editor’s content.

    Declaration
    [Parameter]
    public bool EnableResize { get; set; }
    Property Value
    Type Description
    bool

    true if the image can be resized; otherwise, false. The default value is true.

    Remarks

    Enables image resizing with respect to defined constraints like max/min width and height.

    Height

    Gets or sets the default height value of the image element when inserted into the editor.

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

    A string specifying the height. The default value is auto.

    Remarks

    The height can be given in pixels or percent (%). This property controls the initial height value of images upon insertion.

    MaxFileSize

    Gets or sets the maximum allowed file size of the image element to be uploaded in bytes.

    Declaration
    [Parameter]
    public double MaxFileSize { get; set; }
    Property Value
    Type Description
    double

    A double value representing the maximum file size for the image element. The default value is 30000000.

    Remarks

    This property ensures that overly large files cannot be uploaded.

    MaxHeight

    Gets or sets the maximum height constraint of the image element.

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

    A string representing the maximum height.

    Remarks

    Specifies the maximum allowable height for images, adjustable in pixels or percent (%).

    MaxWidth

    Gets or sets the maximum width constraint of the image element.

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

    A string representing the maximum width.

    Remarks

    Specifies the maximum allowable width for images, adjustable in pixels or percent (%).

    MinHeight

    Gets or sets the minimum height constraint of the image element.

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

    A string representing the minimum height.

    Remarks

    Specifies the minimum allowable height for images, adjustable in pixels or percent (%).

    MinWidth

    Gets or sets the minimum width constraint of the image element.

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

    A string representing the minimum width.

    Remarks

    Specifies the minimum allowable width for images, adjustable in pixels or percent (%).

    Path

    Gets or sets the URL of the image save location.

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

    The URL string where the image file is saved. The default value is String.Empty.

    Examples

    In this example, upload images to the wwwroot/images folder.

    @using Syncfusion.Blazor.RichTextEditor;
    <SfRichTextEditor>
       <RichTextEditorImageSettings Path="wwwroot/images" />
    </SfRichTextEditor>

    RemoveUrl

    Specifies the URL of the remove action that handles the removal of images on the server.

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

    The URL for the remove action for deleting images on the server. The default value is String.Empty.

    Remarks

    Handles POST requests for operations like undoing upload, removing images from dialogs, and cleanup.

    Examples

    This example calls the Remove method API endpoint during image removal.

    @using Syncfusion.Blazor.RichTextEditor;
    <SfRichTextEditor>
       <RichTextEditorImageSettings RemoveUrl="/api/imageupload/Remove" />
    </SfRichTextEditor>

    ResizeByPercent

    Specifies whether image resizing should enable percentage calculation.

    Declaration
    [Parameter]
    public bool ResizeByPercent { get; set; }
    Property Value
    Type Description
    bool

    true if resizing considers percentage-based calculations; otherwise, false. The default value is true.

    SaveFormat

    Specifies whether the inserted image is saved as blob or base64 format.

    Declaration
    [Parameter]
    public SaveFormat SaveFormat { get; set; }
    Property Value
    Type Description
    SaveFormat

    A value from the SaveFormat enumeration. The default value is Blob.

    SaveUrl

    Specifies the URL of the save action that receives the uploaded image and saves it on the server.

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

    The URL for the save action for uploading and saving images on the server. The default value is String.Empty.

    Remarks

    Handles POST requests when actions like image insertion, replacement, and dragging of files occur.

    Examples

    This example calls the Save method API endpoint during image uploading.

    @using Syncfusion.Blazor.RichTextEditor;
    <SfRichTextEditor>
       <RichTextEditorImageSettings SaveUrl="/api/imageupload/Save" />
    </SfRichTextEditor>

    Width

    Gets or sets the width of the image when inserted into the editor.

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

    The width of the component in pixels or percent (%) as a string. The default value is auto.

    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)

    OnAfterRenderAsync(bool)

    Method invoked after each time the component has been rendered.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender

    Set to true if this is the first time OnAfterRender(Boolean) has been invoked.

    Returns
    Type Description
    Task

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

    Overrides
    ComponentBase.OnAfterRenderAsync(bool)

    OnInitializedAsync()

    Method invoked when the component is ready to start.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task representing any 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()

    ShouldRender()

    Declaration
    protected override bool ShouldRender()
    Returns
    Type
    bool
    Overrides
    ComponentBase.ShouldRender()

    Implements

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