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
Namespace: Syncfusion.Blazor.RichTextEditor
Assembly: Syncfusion.Blazor.dll
Syntax
public class RichTextEditorImageSettings : OwningComponentBase
Constructors
RichTextEditorImageSettings()
Declaration
public RichTextEditorImageSettings()
Properties
AllowedTypes
Gets or sets image extensions that populate the allowed types of images on browse.
Declaration
public List<string> AllowedTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The list of image types that are allowed to be uploaded. The default values are |
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
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
public bool EnableResize { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
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
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string specifying the height. The default value is |
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
public double MaxFileSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double value representing the maximum file size for the image element. The default value is |
Remarks
This property ensures that overly large files cannot be uploaded.
MaxHeight
Gets or sets the maximum height constraint of the image element.
Declaration
public string MaxHeight { get; set; }
Property Value
Type | Description |
---|---|
System.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
public string MaxWidth { get; set; }
Property Value
Type | Description |
---|---|
System.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
public string MinHeight { get; set; }
Property Value
Type | Description |
---|---|
System.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
public string MinWidth { get; set; }
Property Value
Type | Description |
---|---|
System.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
public string Path { get; set; }
Property Value
Type | Description |
---|---|
System.String | The URL string where the image file is saved. The default value is |
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
public string RemoveUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | The URL for the remove action for deleting images on the server. The default value is |
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
public bool ResizeByPercent { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
SaveFormat
Specifies whether the inserted image is saved as blob or base64 format.
Declaration
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
public string SaveUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | The URL for the save action for uploading and saving images on the server. The default value is |
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
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | The width of the component in pixels or percent (%) as a string. The default value is |
Methods
Dispose(Boolean)
Dispose unmanaged resources in the Syncfusion Blazor component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Boolean value to dispose the object. |
OnAfterRenderAsync(Boolean)
Method invoked after each time the component has been rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender | Set to true if this is the first time OnAfterRender(Boolean) has been invoked. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
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. |
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. |
ShouldRender()
Declaration
protected override bool ShouldRender()
Returns
Type |
---|
System.Boolean |