Syncfusion Vue BlockEditor Component
The Syncfusion Vue BlockEditor is a powerful block-based content editor that enables users to create, format, and organize content using various block types. This skill guides you through implementing the BlockEditor component with Vue 3 Composition API, covering all 14 block types, menus, methods, events, and advanced features.
Component Overview
The Vue BlockEditor component provides:
- 14 Block Types: Paragraph, Heading (1-4), BulletList, NumberedList, Checklist, Code, Image, Table, Quote, Callout, Divider, Collapsible (Paragraph/Heading), Template
- 5 Content Types: Text, Link, Mention, Label, InlineCode
- 4 Interactive Menus: Slash Command (
/), Context Menu (right-click), Block Action Menu, Inline Toolbar
- Drag & Drop: Visual block reordering with handles
- 20+ Methods: Block CRUD, selection, data export (JSON/HTML), formatting
- 14 Events: Block changes, drag/drop, paste, file upload, focus/blur
- Advanced Features: Syntax highlighting, image upload, table editing, undo/redo, keyboard shortcuts
Documentation and Navigation Guide
Getting Started & Installation
📄 Read: references/getting-started.md
- Vue 3 + Vite project setup
- Package installation (
@syncfusion/ej2-vue-blockeditor)
- CSS theme imports (Material, Bootstrap, Fluent, Tailwind)
- Component registration with Composition API (
<script setup>)
- Basic BlockEditor initialization
- First render example
Block Types & Structure
📄 Read: references/block-types.md
- All 14 block types with examples
- BlockModel structure (id, blockType, content, properties)
- Block properties configuration
- Custom templates
- Indent and CSS class customization
- Block type selection guide
Inline Content & Formatting
📄 Read: references/inline-content.md
- ContentModel structure
- 5 content types (Text, Link, Mention, Label, InlineCode)
- Inline styles (bold, italic, underline, strikethrough, color, background)
- Link properties and URL configuration
- User mentions with
users array
- Label/tag configuration with trigger characters
- Inline formatting examples
Typography Blocks
📄 Read: references/typography-blocks.md
- Paragraph blocks with placeholders
- Heading blocks (levels 1-4)
- Heading level selection
- Divider blocks for section separation
- Placeholder customization
- Typography examples
List Blocks
📄 Read: references/list-blocks.md
- BulletList (unordered lists)
- NumberedList (ordered lists)
- Checklist with
isChecked state
- List placeholder customization
- Interactive checklist examples
Nested & Collapsible Blocks
📄 Read: references/nested-blocks.md
- Children property for nested structures
- Parent-child relationships (
parentId)
- CollapsibleHeading (levels 1-4)
- CollapsibleParagraph blocks
isExpanded state configuration
- Quote blocks with multi-line support
- Callout blocks for important information
- Nested block examples
Special Blocks (Code, Image, Table)
📄 Read: references/special-blocks.md
- Code blocks with syntax highlighting
codeBlockSettings (languages, defaultLanguage)
- Image blocks with upload and resize
imageBlockSettings (saveUrl, path, maxFileSize, allowedTypes)
- Table blocks with rows, columns, cells
- Table properties (width, enableHeader, enableRowNumbers)
- Table resizing and multiple row/column selection
- File upload configuration
Editor Menus & Toolbars
📄 Read: references/editor-menus.md
- Slash Command Menu (
/ trigger) - commandMenuSettings
- Context Menu (right-click) -
contextMenuSettings
- Block Action Menu (hover drag handle) -
blockActionMenuSettings
- Inline Toolbar (text selection) -
inlineToolbarSettings
- Transform settings for block type conversion
- Font color and background color settings
- Menu customization and events
- Custom menu items
Methods & Programmatic Control
📄 Read: references/methods-api.md
- Block management:
addBlock(), removeBlock(), updateBlock(), moveBlock()
- Selection:
setSelection(), getSelectedBlocks(), selectBlock(), selectAllBlocks()
- Cursor:
setCursorPosition(), focusIn(), focusOut()
- Data export:
getDataAsJson(), getDataAsHtml(), print()
- Formatting:
executeToolbarAction(), enableToolbarItems(), disableToolbarItems()
- HTML parsing:
parseHtmlToBlocks(), renderBlocksFromJson()
- Method usage with Composition API patterns
Events & Lifecycle
📄 Read: references/events-lifecycle.md
- Block change events:
blockChanged
- Drag & drop:
blockDragStart, blockDragging, blockDropped
- Focus events:
focus, blur
- Selection:
selectionChanged
- Paste:
beforePasteCleanup, afterPasteCleanup
- File upload:
beforeFileUpload, fileUploading, fileUploadSuccess, fileUploadFailed
- Created event
- Event handler patterns with Composition API
Features & Configuration
📄 Read: references/features-configuration.md
- Drag and drop:
enableDragAndDrop
- Paste cleanup:
pasteCleanupSettings (deniedTags, keepFormat, plainText)
- Undo/redo:
undoRedoStack (default: 30)
- Keyboard shortcuts:
keyConfig customization
- Read-only mode:
readOnly
- Persistence:
enablePersistence
- Custom styling:
cssClass
- Height/width:
height, width
Collaborative Editing
📄 Read: references/collaborative-editing.md
- Real-time collaborative editing with Yjs CRDT framework
- Yjs providers (y-websocket, y-webrtc, y-indexeddb, Hocuspocus, Liveblocks, PartyKit)
collaborationSettings configuration (adapter, provider, enableAwareness, versionHistory)
- User presence and remote cursors with
enableAwareness
- User identification with
users array and currentUserId
- Version history with snapshots, restore, compare, export/import
- Collaboration-aware undo/redo operations
- Best practices for development and production deployment
Accessibility & Globalization
📄 Read: references/accessibility-globalization.md
- WCAG 2.2 and Section 508 compliance
- WAI-ARIA attributes
- Keyboard navigation shortcuts
- Localization:
locale property with L10n
- RTL support:
enableRtl
- Security:
enableHtmlSanitizer (XSS prevention), enableHtmlEncode
- Localization examples (German, Arabic, etc.)
Quick Start Example
Install the theme package that matches your application. This example uses Tailwind 3:
npm install @syncfusion/ej2-tailwind3-theme
<template>
<div>
<ejs-blockeditor
ref="blockEditor"
:blocks="blocks"
:users="users"
:enableDragAndDrop="true"
@blockChanged="onBlockChanged"
/>
</div>
</template>
<script setup>
import { ref } from 'vue';
import { BlockEditorComponent as EjsBlockeditor, ContentType } from '@syncfusion/ej2-vue-blockeditor';
const blockEditor = ref(null);
const blocks = [
{
id: 'heading-1',
blockType: 'Heading',
properties: { level: 1 },
content: [
{ contentType: ContentType.Text, content: 'Welcome to BlockEditor' }
]
},
{
id: 'intro-para',
blockType: 'Paragraph',
content: [
{ contentType: ContentType.Text, content: 'Create content using blocks. Type ' },
{ contentType: ContentType.Text, content: '/', properties: { styles: { bold: true } } },
{ contentType: ContentType.Text, content: ' for commands.' }
]
},
{
id: 'checklist-1',
blockType: 'Checklist',
properties: { isChecked: false },
content: [
{ contentType: ContentType.Text, content: 'Complete the tutorial' }
]
}
];
const users = [
{ id: 'user1', user: 'John Doe' },
{ id: 'user2', user: 'Jane Smith' }
];
const => {
console.log('Block changed:', args.changes);
};
</script>
<style>
@import '../node_modules/@syncfusion/ej2-tailwind3-theme/styles/blockeditor/index.css';
</style>
1---2name: syncfusion-vue-blockeditor3description: Implement Syncfusion Vue BlockEditor component for block-based content editing with rich text, images, tables, and interactive blocks. Use this skill ALWAYS when user needs block editor, notion-style editor, content blocks, rich text blocks, document editor with blocks, modular content editor, or mentions @syncfusion/ej2-vue-blockeditor, BlockEditor, block-based editing, content management editor, collaborative editing, real-time collaboration. Covers all 14 block types, 5 content types, drag-and-drop, menus, methods, events, real-time collaborative editing with Yjs support, user presence and remote cursors, version history, and Composition API patterns.4---56# Syncfusion Vue BlockEditor Component78The Syncfusion Vue BlockEditor is a powerful block-based content editor that enables users to create, format, and organize content using various block types. This skill guides you through implementing the BlockEditor component with Vue 3 Composition API, covering all 14 block types, menus, methods, events, and advanced features.910## Component Overview1112The Vue BlockEditor component provides:1314- **14 Block Types:** Paragraph, Heading (1-4), BulletList, NumberedList, Checklist, Code, Image, Table, Quote, Callout, Divider, Collapsible (Paragraph/Heading), Template15- **5 Content Types:** Text, Link, Mention, Label, InlineCode16- **4 Interactive Menus:** Slash Command (`/`), Context Menu (right-click), Block Action Menu, Inline Toolbar17- **Drag & Drop:** Visual block reordering with handles18- **20+ Methods:** Block CRUD, selection, data export (JSON/HTML), formatting19- **14 Events:** Block changes, drag/drop, paste, file upload, focus/blur20- **Advanced Features:** Syntax highlighting, image upload, table editing, undo/redo, keyboard shortcuts2122## Documentation and Navigation Guide2324### Getting Started & Installation25📄 **Read:** [references/getting-started.md](references/getting-started.md)26- Vue 3 + Vite project setup27- Package installation (`@syncfusion/ej2-vue-blockeditor`)28- CSS theme imports (Material, Bootstrap, Fluent, Tailwind)29- Component registration with Composition API (`<script setup>`)30- Basic BlockEditor initialization31- First render example3233### Block Types & Structure34📄 **Read:** [references/block-types.md](references/block-types.md)35- All 14 block types with examples36- BlockModel structure (id, blockType, content, properties)37- Block properties configuration38- Custom templates39- Indent and CSS class customization40- Block type selection guide4142### Inline Content & Formatting43📄 **Read:** [references/inline-content.md](references/inline-content.md)44- ContentModel structure45- 5 content types (Text, Link, Mention, Label, InlineCode)46- Inline styles (bold, italic, underline, strikethrough, color, background)47- Link properties and URL configuration48- User mentions with `users` array49- Label/tag configuration with trigger characters50- Inline formatting examples5152### Typography Blocks53📄 **Read:** [references/typography-blocks.md](references/typography-blocks.md)54- Paragraph blocks with placeholders55- Heading blocks (levels 1-4)56- Heading level selection57- Divider blocks for section separation58- Placeholder customization59- Typography examples6061### List Blocks62📄 **Read:** [references/list-blocks.md](references/list-blocks.md)63- BulletList (unordered lists)64- NumberedList (ordered lists)65- Checklist with `isChecked` state66- List placeholder customization67- Interactive checklist examples6869### Nested & Collapsible Blocks70📄 **Read:** [references/nested-blocks.md](references/nested-blocks.md)71- Children property for nested structures72- Parent-child relationships (`parentId`)73- CollapsibleHeading (levels 1-4)74- CollapsibleParagraph blocks75- `isExpanded` state configuration76- Quote blocks with multi-line support77- Callout blocks for important information78- Nested block examples7980### Special Blocks (Code, Image, Table)81📄 **Read:** [references/special-blocks.md](references/special-blocks.md)82- Code blocks with syntax highlighting83- `codeBlockSettings` (languages, defaultLanguage)84- Image blocks with upload and resize85- `imageBlockSettings` (saveUrl, path, maxFileSize, allowedTypes)86- Table blocks with rows, columns, cells87- Table properties (width, enableHeader, enableRowNumbers)88- Table resizing and multiple row/column selection89- File upload configuration9091### Editor Menus & Toolbars92📄 **Read:** [references/editor-menus.md](references/editor-menus.md)93- Slash Command Menu (`/` trigger) - `commandMenuSettings`94- Context Menu (right-click) - `contextMenuSettings`95- Block Action Menu (hover drag handle) - `blockActionMenuSettings`96- Inline Toolbar (text selection) - `inlineToolbarSettings`97- Transform settings for block type conversion98- Font color and background color settings99- Menu customization and events100- Custom menu items101102### Methods & Programmatic Control103📄 **Read:** [references/methods-api.md](references/methods-api.md)104- Block management: `addBlock()`, `removeBlock()`, `updateBlock()`, `moveBlock()`105- Selection: `setSelection()`, `getSelectedBlocks()`, `selectBlock()`, `selectAllBlocks()`106- Cursor: `setCursorPosition()`, `focusIn()`, `focusOut()`107- Data export: `getDataAsJson()`, `getDataAsHtml()`, `print()`108- Formatting: `executeToolbarAction()`, `enableToolbarItems()`, `disableToolbarItems()`109- HTML parsing: `parseHtmlToBlocks()`, `renderBlocksFromJson()`110- Method usage with Composition API patterns111112### Events & Lifecycle113📄 **Read:** [references/events-lifecycle.md](references/events-lifecycle.md)114- Block change events: `blockChanged`115- Drag & drop: `blockDragStart`, `blockDragging`, `blockDropped`116- Focus events: `focus`, `blur`117- Selection: `selectionChanged`118- Paste: `beforePasteCleanup`, `afterPasteCleanup`119- File upload: `beforeFileUpload`, `fileUploading`, `fileUploadSuccess`, `fileUploadFailed`120- Created event121- Event handler patterns with Composition API122123### Features & Configuration124📄 **Read:** [references/features-configuration.md](references/features-configuration.md)125- Drag and drop: `enableDragAndDrop`126- Paste cleanup: `pasteCleanupSettings` (deniedTags, keepFormat, plainText)127- Undo/redo: `undoRedoStack` (default: 30)128- Keyboard shortcuts: `keyConfig` customization129- Read-only mode: `readOnly`130- Persistence: `enablePersistence`131- Custom styling: `cssClass`132- Height/width: `height`, `width`133134### Collaborative Editing135📄 **Read:** [references/collaborative-editing.md](references/collaborative-editing.md)136- Real-time collaborative editing with Yjs CRDT framework137- Yjs providers (y-websocket, y-webrtc, y-indexeddb, Hocuspocus, Liveblocks, PartyKit)138- `collaborationSettings` configuration (adapter, provider, enableAwareness, versionHistory)139- User presence and remote cursors with `enableAwareness`140- User identification with `users` array and `currentUserId`141- Version history with snapshots, restore, compare, export/import142- Collaboration-aware undo/redo operations143- Best practices for development and production deployment144145### Accessibility & Globalization146📄 **Read:** [references/accessibility-globalization.md](references/accessibility-globalization.md)147- WCAG 2.2 and Section 508 compliance148- WAI-ARIA attributes149- Keyboard navigation shortcuts150- Localization: `locale` property with L10n151- RTL support: `enableRtl`152- Security: `enableHtmlSanitizer` (XSS prevention), `enableHtmlEncode`153- Localization examples (German, Arabic, etc.)154155## Quick Start Example156157Install the theme package that matches your application. This example uses `Tailwind 3`:158159```bash160npm install @syncfusion/ej2-tailwind3-theme161```162163```vue164<template>165 <div>166 <ejs-blockeditor 167 ref="blockEditor"168 :blocks="blocks"169 :users="users"170 :enableDragAndDrop="true"171 @blockChanged="onBlockChanged"172 />173 </div>174</template>175176<script setup>177import { ref } from 'vue';178import { BlockEditorComponent as EjsBlockeditor, ContentType } from '@syncfusion/ej2-vue-blockeditor';179180const blockEditor = ref(null);181182const blocks = [183 {184 id: 'heading-1',185 blockType: 'Heading',186 properties: { level: 1 },187 content: [188 { contentType: ContentType.Text, content: 'Welcome to BlockEditor' }189 ]190 },191 {192 id: 'intro-para',193 blockType: 'Paragraph',194 content: [195 { contentType: ContentType.Text, content: 'Create content using blocks. Type ' },196 { contentType: ContentType.Text, content: '/', properties: { styles: { bold: true } } },197 { contentType: ContentType.Text, content: ' for commands.' }198 ]199 },200 {201 id: 'checklist-1',202 blockType: 'Checklist',203 properties: { isChecked: false },204 content: [205 { contentType: ContentType.Text, content: 'Complete the tutorial' }206 ]207 }208];209210const users = [211 { id: 'user1', user: 'John Doe' },212 { id: 'user2', user: 'Jane Smith' }213];214215const onBlockChanged = (args) => {216 console.log('Block changed:', args.changes);217};218</script>219220<style>221@import '../node_modules/@syncfusion/ej2-tailwind3-theme/styles/blockeditor/index.css';222</style>223```