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/editor-modes.md
View on GitHub# Editor Modes
## Table of Contents
- [HTML Mode (Default)](#html-mode-default)
- [IFrame Mode](#iframe-mode)
- [Markdown Mode](#markdown-mode)
- [Source Code / HTML View](#source-code--html-view)
---
## HTML Mode (Default)
`EditorMode.HTML` renders a contenteditable DIV. All toolbar formatting produces standard HTML tags. This is the default and requires no explicit configuration:
```razor
@using Syncfusion.Blazor.RichTextEditor
<SfRichTextEditor EditorMode="EditorMode.HTML">
<p>The Rich Text Editor is a WYSIWYG editor that returns <b>valid HTML</b>.</p>
<ul>
<li>Supports IFRAME and DIV modes</li>
<li>Modular toolbar</li>
<li>Markdown editing</li>
</ul>
</SfRichTextEditor>
```
`Value` / `@bind-Value` contains the serialised HTML string.
---
## IFrame Mode
IFrame mode renders the editing surface inside a sandboxed `<iframe>`, isolating its CSS from the host page. Use it when the host application's global styles would interfere with the editor content.
`IFrame mode` is enabled via the `<RichTextEditorIFrameSettings Enable="true" />` **child component** nested inside `<SfRichTextEditor>`
```razor
@using Syncfusion.Blazor.RichTextEditor
<SfRichTextEditor>
<RichTextEditorIFrameSettings Enable="true" />
<p>Editing in an isolated iframe — host-page styles do not bleed in.</p>
</SfRichTextEditor>
```
### Customizing IFrame Body Attributes
Pass additional attributes to the iframe body element using `Attributes`:
```razor
<SfRichTextEditor>
<RichTextEditorIFrameSettings Enable="true" Attributes="@IframeAttributes" />
</SfRichTextEditor>
@code {
private Dictionary<string, object> IframeAttributes = new()
{
{ "style", "background: lightgray;" }
};
}
```
### Injecting External CSS and Scripts
Inject external stylesheets or scripts into the iframe document using `Resources`:
```razor
<SfRichTextEditor>
<RichTextEditorIFrameSettings Enable="true" Resources="@Resources" />
</SfRichTextEditor>
@code {
private ResourcesModel Resources { get; set; } = new ResourcesModel()
{
Styles = new string[] { "/styles.css" },
Scripts = new string[] { "/script.js" }
};
}
```
> The `ResourcesModel` accepts `Styles` (CSS paths) and `Scripts` (JS paths) — both are string arrays resolved relative to the app root. See `properties.md → RichTextEditorIFrameSettings` for the full child-component reference.
---
## Markdown Mode
Set `EditorMode="EditorMode.Markdown"` to switch to Markdown editing. The editor input and `Value` property use Markdown syntax. A third-party library such as **Marked.js** must be added to the page to render a live HTML preview.
**Supported block tags:** `h1`–`h6`, `blockquote`, `pre`, `p`, ordered list (`OL`), unordered list (`UL`)
**Supported inline tags:** Bold, Italic, StrikeThrough, InlineCode, Subscript, Superscript, UpperCase, LowerCase
```razor
<SfRichTextEditor EditorMode="EditorMode.Markdown" @bind-Value="@MarkdownValue">
***Overview*** The Rich Text Editor supports Markdown editing mode.
***Key features***
*Mode*: Provides IFRAME and DIV mode.
*Toolbar*: Provide a fully customizable toolbar.
*Preview*: Preview the modified content before saving it.
</SfRichTextEditor>
@code {
private string MarkdownValue { get; set; } = string.Empty;
}
```
### Markdown Toolbar Items
For Markdown mode, use markdown-specific toolbar commands instead of the HTML defaults:
```razor
<RichTextEditorToolbarSettings Items="@MdTools" />
@code {
private List<ToolbarItemModel> MdTools = new()
{
new() { Command = ToolbarCommand.Bold },
new() { Command = ToolbarCommand.Italic },
new() { Command = ToolbarCommand.StrikeThrough },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.OrderedList },
new() { Command = ToolbarCommand.UnorderedList },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.Formats },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.Preview }, // live HTML preview
new() { Command = ToolbarCommand.Undo },
new() { Command = ToolbarCommand.Redo }
};
}
```
### Displaying a Markdown Preview
**Security:** Do not load Marked from external CDNs. Bundle locally instead.
Download `marked.min.js` and place it in `wwwroot/lib/marked/`:
```html
<!-- wwwroot/index.html or Pages/_Host.cshtml -->
<script src="/lib/marked/marked.min.js"></script>
```
```razor
<SfRichTextEditor EditorMode="EditorMode.Markdown" @bind-Value="@MarkdownValue">
<RichTextEditorEvents ValueChange="@OnValueChange" />
</SfRichTextEditor>
<div @ref="PreviewDiv"></div>
@code {
private string MarkdownValue { get; set; } = string.Empty;
private ElementReference PreviewDiv;
[Inject] private IJSRuntime JS { get; set; } = default!;
private async Task OnValueChange(Syncfusion.Blazor.RichTextEditor.ChangeEventArgs args)
{
await JS.InvokeVoidAsync("renderMarkdown", PreviewDiv, args.Value);
}
}
```
```js
// wwwroot/app.js
function renderMarkdown(el, markdown) {
el.innerHTML = marked.parse(markdown ?? "");
}
```
---
## Source Code / HTML View
Add `ToolbarCommand.SourceCode` to the toolbar to give users an HTML source editor. This is available in HTML mode only — Markdown mode has a `Preview` button instead:
```razor
<RichTextEditorToolbarSettings Items="@Tools" />
@code {
private List<ToolbarItemModel> Tools = new()
{
new() { Command = ToolbarCommand.Bold },
new() { Command = ToolbarCommand.Italic },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.SourceCode } // toggle HTML source view
};
}
```
> Toggling to source code view and back does not lose content. The WYSIWYG surface and source view stay in sync.
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 |