syncfusion/blazor-ui-components-skills / skills/syncfusion-blazor-rich-text-editor
syncfusion-blazor-rich-text-editor
VerifiedImplements the Syncfusion Blazor Rich Text Editor (SfRichTextEditor) from Syncfusion.Blazor.RichTextEditor. Supports HTML, Markdown, and IFrame editor modes. Use this skills for toolbar configuration, image/video/audio insertion, table management, paste cleanup, import/export Word/PDF, accessibility, globalization, RTL, and inline or custom toolbar tool scenarios in Blazor applications.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.1 KB |
| references/accessibility-globalization.md | markdown | 6.7 KB |
| references/built-in-tools.md | markdown | 6.7 KB |
| references/custom-tools.md | markdown | 9.1 KB |
| references/data-binding.md | markdown | 4.6 KB |
| references/editor-modes.md | markdown | 5.8 KB |
| references/events.md | markdown | 23.6 KB |
| references/getting-started.md | markdown | 4.9 KB |
| references/images-and-media.md | markdown | 7.2 KB |
| references/import-export.md | markdown | 8.1 KB |
| references/inline-mode.md | markdown | 4.3 KB |
| references/methods.md | markdown | 10.3 KB |
| references/paste-and-cleanup.md | markdown | 6.7 KB |
| references/properties.md | markdown | 12.2 KB |
| references/tables.md | markdown | 8.1 KB |
| references/text-formatting.md | markdown | 7.0 KB |
| references/toolbar.md | markdown | 6.9 KB |
references/images-and-media.md
View on GitHub# Images, Video, and Audio
## Table of Contents
- [Image Settings Properties](#image-settings-properties)
- [Insert Image From URL](#insert-image-from-url)
- [Upload and Save Images Server-Side](#upload-and-save-images-server-side)
- [Image Save Format](#image-save-format)
- [Image Restrictions](#image-restrictions)
- [Image Quick Toolbar](#image-quick-toolbar)
- [Server-Side Delete on Image Removal](#server-side-delete-on-image-removal)
- [Video Settings](#video-settings)
- [Audio Settings](#audio-settings)
---
## Image Settings Properties
> **Security:** Validate external media URLs against a whitelist of trusted domains before embedding.
Use `RichTextEditorImageSettings` to control image behaviour:
| Property | Type | Description |
|---|---|---|
| `AllowedTypes` | `List<string>` | Allowed file extensions, e.g. `new() { ".jpg", ".png", ".gif" }` |
| `SaveUrl` | `string` | API endpoint to receive the uploaded image |
| `Path` | `string` | Server path prefix appended to saved file name (must be under `wwwroot`) |
| `SaveFormat` | `SaveFormat` | `Blob` (default) or `Base64` |
| `Display` | `ImageDisplay` | Default display: `Inline` or `Break` |
| `Width` / `Height` | `string` | Default dimensions when inserted |
| `MinWidth` / `MaxWidth` | `string` | Resize constraints |
| `MinHeight` / `MaxHeight` | `string` | Resize constraints |
| `EnableResize` | `bool` | Whether to show resize handles (default `true`) |
| `ResizeByPercent` | `bool` | Resize using percentage instead of pixel values |
| `MaxFileSize` | `double` | Maximum upload file size in bytes |
---
## Insert Image From URL
No configuration needed — the `Image` toolbar item opens a dialog where users can paste an online URL:
```razor
<SfRichTextEditor>
<RichTextEditorToolbarSettings Items="@Tools" />
</SfRichTextEditor>
@code {
private List<ToolbarItemModel> Tools = new()
{
new() { Command = ToolbarCommand.Image }
};
}
```
If no `SaveUrl` or `Path` is set, locally browsed images are inserted as `blob:` URLs (temporary, lost on reload) or Base64, depending on `SaveFormat`.
---
## Upload and Save Images Server-Side
**Component:**
```razor
<SfRichTextEditor>
<RichTextEditorImageSettings SaveUrl="api/Image/Save" Path="./Images/" />
<RichTextEditorToolbarSettings Items="@Tools" />
</SfRichTextEditor>
```
**Minimal ASP.NET Core controller:**
```csharp
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System.Net.Http.Headers;
[ApiController]
public class ImageController : ControllerBase
{
private readonly IWebHostEnvironment _env;
public ImageController(IWebHostEnvironment env) => _env = env;
[HttpPost("[action]")]
[Route("api/Image/Save")]
public void Save(IList<IFormFile> UploadFiles)
{
foreach (var file in UploadFiles)
{
string targetPath = Path.Combine(_env.ContentRootPath, "wwwroot", "Images");
Directory.CreateDirectory(targetPath);
string fileName = ContentDispositionHeaderValue
.Parse(file.ContentDisposition).FileName.Trim('"');
string fullPath = Path.Combine(targetPath, fileName);
if (!System.IO.File.Exists(fullPath))
{
using var fs = System.IO.File.Create(fullPath);
file.CopyTo(fs);
Response.StatusCode = 200;
}
else
{
Response.StatusCode = 204; // Already exists
}
}
}
}
```
> The `Path` property must be a directory under `wwwroot`. You cannot save outside `wwwroot` in Blazor static file serving.
---
## Image Save Format
Force Base64 encoding (no server needed, but increases HTML payload size):
```razor
<SfRichTextEditor>
<RichTextEditorImageSettings SaveFormat="SaveFormat.Base64" />
</SfRichTextEditor>
```
Use Base64 for: small images, self-contained HTML exports, prototyping.
Use server save for: production apps, large images, long-term storage.
---
## Image Restrictions
Limit file size (in bytes):
```razor
<SfRichTextEditor>
<RichTextEditorImageSettings MaxFileSize="5000000" AllowedTypes='new() { ".jpg", ".png", ".webp" }' />
</SfRichTextEditor>
```
> Size restriction only applies to file browse uploads, not to images pasted as hyperlinks.
---
## Image Quick Toolbar
Show editing actions when a user clicks an inserted image:
```razor
<SfRichTextEditor>
<RichTextEditorQuickToolbarSettings Image="@ImageTools" />
</SfRichTextEditor>
@code {
private List<ImageToolbarItemModel> ImageTools = new()
{
new() { Command = ImageToolbarCommand.Replace },
new() { Command = ImageToolbarCommand.Align },
new() { Command = ImageToolbarCommand.Caption },
new() { Command = ImageToolbarCommand.Remove },
new() { Command = ImageToolbarCommand.HorizontalSeparator },
new() { Command = ImageToolbarCommand.OpenImageLink },
new() { Command = ImageToolbarCommand.EditImageLink },
new() { Command = ImageToolbarCommand.RemoveImageLink },
new() { Command = ImageToolbarCommand.HorizontalSeparator },
new() { Command = ImageToolbarCommand.Display },
new() { Command = ImageToolbarCommand.AltText },
new() { Command = ImageToolbarCommand.Dimension }
};
}
```
---
## Server-Side Delete on Image Removal
The `ImageDelete` event fires after an image is removed from the editor. Use it to delete the file from your server:
```razor
<SfRichTextEditor>
<RichTextEditorImageSettings
SaveUrl="api/Image/Save"
Path="./Images/"
RemoveUrl="api/Image/Delete" />
<RichTextEditorEvents ImageDelete="OnImageDeleted" />
</SfRichTextEditor>
@code {
@inject HttpClient Http
private async Task OnImageDeleted(AfterImageDeleteEventArgs args)
{
var fileName = args.Src.Split('/').Last();
var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(Array.Empty<byte>()), "UploadFiles", fileName);
await Http.PostAsync("api/Image/Delete", form);
}
}
```
> Without this handler, deleting an image in the editor only removes the `<img>` tag — the file remains on disk.
---
## Video Settings
Add `ToolbarCommand.Video` to the toolbar, then configure `RichTextEditorVideoSettings`:
```razor
<SfRichTextEditor>
<RichTextEditorToolbarSettings Items="@Tools" />
<RichTextEditorVideoSettings
SaveUrl="api/Video/Save"
Path="./Videos/"
AllowedTypes='new() { ".mp4", ".webm" }'
EnableResize="true"
Width="300px"
Height="200px" />
</SfRichTextEditor>
```
Videos can also be inserted as **embedded URLs** (e.g. YouTube iframes) from the dialog — no upload needed.
Quick toolbar commands for video: `Replace`, `Edit`, `Remove`, `Display`, `Dimension`.
---
## Audio Settings
Add `ToolbarCommand.Audio` to the toolbar, then configure `RichTextEditorAudioSettings`:
```razor
<SfRichTextEditor>
<RichTextEditorToolbarSettings Items="@Tools" />
<RichTextEditorAudioSettings
SaveUrl="api/Audio/Save"
Path="./Audio/"
AllowedTypes='new() { ".mp3", ".wav", ".ogg" }' />
</SfRichTextEditor>
```
Audio can be inserted from a web URL or uploaded from the local machine.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |