Skip to main content 首页 创作者 syncfusion aspnetmvc-ui-components-skills syncfusion-aspnetmvc-blockeditor
syncfusion-aspnetmvc-blockeditor Implement Syncfusion ASP.NET MVC Block Editor control. Use when building block-based rich content editors, configuring block types (Paragraph, Heading, List, Code, Table, Image, Callout, Collapsible), handling drag-and-drop, editor menus (slash command, context, block action, inline toolbar), events, methods, paste cleanup, undo/redo, globalization, appearance, collaborative editing with real-time synchronization, version history, and user presence features in ASP.NET MVC Razor views.
跳到安装 Skills Marketplace 发现并探索由社区构建的 Agent Skills
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/syncfusion/aspnetmvc-ui-components-skills --skill syncfusion-aspnetmvc-blockeditor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
下载 Zip 下载中... name syncfusion-aspnetmvc-blockeditor description Implement Syncfusion ASP.NET MVC Block Editor control. Use when building block-based rich content editors, configuring block types (Paragraph, Heading, List, Code, Table, Image, Callout, Collapsible), handling drag-and-drop, editor menus (slash command, context, block action, inline toolbar), events, methods, paste cleanup, undo/redo, globalization, appearance, collaborative editing with real-time synchronization, version history, and user presence features in ASP.NET MVC Razor views. metadata {"author":"Syncfusion Inc","version":"34.1.29"}
Syncfusion ASP.NET MVC Block Editor
The Block Editor control provides a block-based rich content editing experience in ASP.NET MVC applications. Content is structured as a collection of typed blocks (Paragraph, Heading, List, Code, Table, Image, etc.), each independently configurable with content, properties, and inline styles.
Quick Start Example
@using Syncfusion.EJ2.BlockEditor
<div id='blockeditor-container'>
@Html.EJS().BlockEditor("block-editor").Render()
</div>
<style>
#blockeditor-container { margin: 20px auto; }
</style>
public ActionResult Index ()
{
return View();
}
With initial blocks:
@using Syncfusion.EJ2.BlockEditor
<div id='blockeditor-container'>
@Html.EJS().BlockEditor("block-editor").Blocks((List<BlockModel>)ViewBag.BlocksData).Render()
</div>
public class
{
id { ; ; }
blockType { ; ; }
properties { ; ; }
List< > content { ; ; }
}
{
blocks = List<BlockModel>
{
BlockModel
{
id = ,
blockType = ,
properties = { level = },
content = List< >
{
{ contentType = , content = }
}
},
BlockModel
{
id = ,
blockType = ,
content = List< >
{
{ contentType = , content = }
}
}
};
ViewBag.BlocksData = blocks;
View();
}
BlockModel
public
string
get
set
public
string
get
set
public
object
get
set
public
object
get
set
public ActionResult Index ()
var
new
new
"heading-1"
"Heading"
new
1
new
object
new
"Text"
"My Document"
new
"para-1"
"Paragraph"
new
object
new
"Text"
"Start writing here."
return
Documentation and Navigation Guide
Getting Started & Installation
Install Syncfusion.EJ2.MVC5 NuGet package
Add namespace reference in Web.config
Link CDN stylesheet and script in _Layout.cshtml
Register the Syncfusion script manager
Render a minimal Block Editor on a page
Block Types & Configuration
Understand all supported block types (Paragraph, Heading, List, Code, Quote, Callout, Divider, Image, Table, Collapsible, Template)
Configure blockType, content, properties, indent, cssClass on individual blocks
Set heading levels (1–4), list types (BulletList, NumberedList, Checklist), checklist isChecked state
Add placeholder text to blocks
Apply per-block CSS classes for custom styling
Use Template blocks for custom HTML content
Inline Content & Styles
Configure contentType (Text, Link, Code, Mention, Label)
Set hyperlink properties (url, openInNewWindow) on Link content
Configure Label content with labelId, trigger character (TriggerChar default: "$"), and LabelSettings
Configure the Users collection and UserModel for Mention content
Configure Mention content with userId
Apply inline text styles: bold, italic, underline, strikethrough, color, backgroundColor, superscript, subscript, uppercase, lowercase, inlineCode
Nested Blocks (Collapsible, Quote, Callout)
Configure CollapsibleHeading or CollapsibleParagraph with children, isExpanded, level
Configure Quote blocks with nested child Paragraph blocks
Configure Callout blocks with nested children
Set parentId (top-level on BlockModel) to establish parent-child relationships
Embed Blocks (Image & Code)
Render an Image block with src, altText, width, height
Configure global ImageBlockSettings (saveUrl, path, saveFormat, allowedTypes, maxFileSize, enableResize)
Upload images to a server via controller action
Handle image upload lifecycle: BeforeFileUpload (validate/cancel), FileUploading (add auth headers), FileUploadSuccess (read saved URL), FileUploadFailed (error feedback)
Configure Code blocks with syntax highlighting and language selection
Set global CodeBlockSettings (defaultLanguage default: "javascript", languages array)
Table Blocks
Render a Table block with columns, rows, and cells
Configure enableHeader, enableRowNumbers, readOnly, width on a table
Define column headers (headerText) and row cells with columnId and nested blocks
Understand table resizing and multi-row/column selection/deletion
Editor Menus
Customize the Slash Command menu (CommandMenuSettings): popup size, custom commands, tooltip, Filtering/ItemSelect events
Customize the Context menu (ContextMenuSettings): enable, custom items, submenus, ShowItemOnClick, Opening/Closing/ItemSelect events
Customize the Block Action menu (BlockActionsMenuSettings): custom items, tooltip, popup size, Opening/Closing/ItemSelect events
Customize the Inline Toolbar (InlineToolbarSettings): enable, items, popup width, tooltip, ItemClick event
Add Transform, InlineCode, Link items to the Inline Toolbar
Configure font color and background color pickers (FontColorSettings, BackgroundColorSettings)
Events
Handle editor lifecycle: Created, Focus, Blur
Respond to content changes: BlockChanged, SelectionChanged
Handle drag operations: BlockDragStart, BlockDragging, BlockDropped
Intercept paste operations: BeforePasteCleanup, AfterPasteCleanup
Handle image upload lifecycle: BeforeFileUpload, FileUploading, FileUploadSuccess, FileUploadFailed
Methods
Add, remove, move, update, or get blocks programmatically (addBlock, removeBlock, moveBlock, updateBlock, getBlock, getBlockCount)
Manage selection and cursor: setSelection, setCursorPosition, getSelectedBlocks, getRange, selectRange, selectBlock, selectAllBlocks
Manage focus: focusIn, focusOut
Apply formatting: executeToolbarAction, enableToolbarItems, disableToolbarItems
Export content: getDataAsJson, getDataAsHtml, renderBlocksFromJson, parseHtmlToBlocks, print
Always retrieve the component instance via ej.base.getInstance in the Created event
Appearance & Read-Only
Set editor Width and Height
Enable ReadOnly mode (view-only, no edits)
Apply a custom CssClass to the editor container
Persist editor state across page reloads with EnablePersistence
Paste Cleanup
Configure PasteCleanupSettings: DeniedTags, KeepFormat, PlainText
Strip unwanted tags (script, iframe) from pasted content
Paste as plain text stripping all formatting
Undo/Redo & Keyboard Shortcuts
Configure UndoRedoStack size (default: 30)
Know all built-in keyboard shortcuts for formatting, block creation, block management
Customize shortcuts via KeyConfig property
Globalization & Accessibility
Set Locale for localized UI strings (e.g., de for German)
Enable RTL layout with EnableRtl
Know the full localization key table
Drag & Drop
Enable or disable drag and drop with EnableDragAndDrop
Understand single vs. multiple block dragging behavior
Security (XSS Prevention)
Understand the built-in EnableHtmlSanitizer protection (default: true)
Know which elements are automatically removed
Escape HTML characters in output using EnableHtmlEncode (default: false)
Collaborative Editing
Set up real-time collaborative editing using Yjs and providers (y-websocket, y-webrtc, Hocuspocus, Liveblocks, PartyKit)
Configure CollaborationSettings with adapter and provider
Enable user presence and remote cursors with EnableAwareness
Track active collaborators with Users and CurrentUserId
Implement version history with snapshots (create, restore, compare, export, import)
Configure custom snapshot storage using IVersionStorage interface (IndexedDB, database, cloud)
Handle collaboration events: SnapshotCreated, SnapshotRestored
Resolve synchronization issues and optimize performance for multiple users
Key Properties at a Glance Property Type Purpose BlocksList<BlockModel> Initial block content Widthstring Editor width (e.g., "100%", "800px") Heightstring Editor height (e.g., "80vh", "500px") ReadOnlybool Enable view-only mode (default: false) CssClassstring Custom CSS class on editor container EnableDragAndDropbool Allow block reordering (default: true) UndoRedoStackint Max undo/redo steps (default: 30) Localestring Culture code for localization (default: "en-US") EnableRtlbool Right-to-left layout (default: false) EnableHtmlSanitizerbool XSS protection — strips dangerous tags/attrs (default: true) EnableHtmlEncodebool Escape special HTML characters in output (default: false) EnablePersistencebool Persist editor state across page reloads (default: false) KeyConfigobject Custom keyboard shortcut overrides CommandMenuSettingsobject Slash command menu config (/ key) ContextMenuSettingsobject Right-click context menu config BlockActionsMenuobject Block action menu config (hover drag handle) InlineToolbarSettingsobject Inline formatting toolbar config (text selection) TransformSettingsobject Block transform options in the inline toolbar FontColorSettingsobject Font color palette/picker config BackgroundColorSettingsobject Background highlight color palette/picker config PasteCleanupSettingsobject Paste content cleanup rules ImageBlockSettingsobject Global image block configuration CodeBlockSettingsobject Global code block configuration (defaultLanguage: "javascript") LabelSettingsobject Label item definitions and trigger character (default: "$") UsersList<UserModel> User list for @ mention resolution
Common Patterns
Pattern 1 — Get Component Instance Always capture the instance in Created; all method calls require this reference:
var blockEditorObj;
function onCreated ( ) {
blockEditorObj = ej.base .getInstance (
document .getElementById ('block-editor' ),
ejs.blockeditor .BlockEditor
);
}
@Html.EJS().BlockEditor("block-editor").Created("onCreated").Render()
Pattern 2 — Export Content as JSON var jsonData = blockEditorObj.getDataAsJson ();
Pattern 3 — Programmatically Add a Block var newBlock = {
id : 'new-para' ,
blockType : 'Paragraph' ,
content : [{ contentType : 'Text' , content : 'Added programmatically' }]
};
blockEditorObj.addBlock (newBlock, 'existing-block-id' , true );
Pattern 4 — Toggle Read-Only at Runtime blockEditorObj.readOnly = true ;
blockEditorObj.readOnly = false ;
syncfusion-aspnetmvc-grid Implements Syncfusion EJ2 ASP.NET MVC Grid component for feature-rich data tables and grids. Use this when working with data display, sorting, filtering, grouping, aggregates, editing, or exporting. This skill covers grid configuration, CRUD operations, virtual scrolling or infinite scrolling, hierarchy grids, state persistence, and advanced data management features for data-intensive applications.
syncfusion-aspnetmvc-pivot-table Use this skill when users ask how to add or configure Syncfusion PivotView/pivot tables in ASP.NET MVC apps. Trigger for MVC integration, data binding, OLAP/cube setup, aggregation, drill-down/drill-through, grouping, filtering, conditional formatting, exporting, or pivot charts. MVC-only, not Core/Blazor/JS.
syncfusion-aspnetmvc-ai-assistview Implement the Syncfusion ASP.NET MVC AI AssistView component — a conversational AI chat interface with prompt/response rendering, prompt suggestions, custom views, toolbar customization, file attachments, speech-to-text, AI backend integrations (Azure OpenAI, Gemini, Ollama, LiteLLM), generative UI with interactive tools, Chain of Thoughts reasoning visualization and text-to-speech audio playback. Use this skill when building AI chat UIs, integrating LLM backends, configuring assistant toolbars, customizing templates, rendering dynamic UI components, or handling voice input/output in ASP.NET MVC applications.