Documentation Index
Fetch the complete documentation index at: https://mintlify.com/devscribe-team/webeditor/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheWebEditor component is a powerful React-based rich text editor built on ProseMirror. It provides a WYSIWYG editing experience with markdown support, custom components, and extensible functionality.
Installation
Basic usage
Props
The WebEditor component accepts the following props:The initial content of the editor in HTML format. The editor can parse both HTML and markdown-like MDX syntax.When
value changes, the editor will re-initialize with the new content.Controls whether the editor is in edit mode or read-only mode.
- When
true: Users can edit content, insert components, and modify formatting - When
false: Editor displays content in read-only mode without editing controls
Callback function triggered whenever the editor content changes.Receives the updated document content as an HTML string. This fires on every transaction, so consider debouncing for performance-sensitive applications.
Type signature
Features
Command menu
Press/ in an empty paragraph to open the command menu, which provides access to:
- Built-in components (cards, callouts, badges, etc.)
- Formatting options
- Code snippets with syntax highlighting
- Mermaid diagrams
- And more
Marks menu
Select text and press/ to open the marks menu for inline formatting:
- Bold, italic, underline
- Code inline
- Links and tooltips
- Custom text styling
Theme support
The editor automatically detects and responds to system theme preferences (light/dark mode). It uses theuseTheme hook internally to manage theme state.
Keyboard shortcuts
Cmd/Ctrl + Z: UndoCmd/Ctrl + R: Redo/: Open command or marks menuEscape: Close active menuArrow Up/Down: Navigate menu itemsEnter: Execute selected command
Content format
Input format
The editor accepts content in multiple formats:- HTML
- Markdown
Output format
TheonChange callback returns content as HTML:
Examples
Controlled editor
Read-only viewer
With debounced onChange
Styling
The editor uses Tailwind CSS for styling. Make sure to import the styles:.lightfor light mode.darkfor dark mode
Performance considerations
The
onChange callback fires on every transaction. For performance-sensitive applications, consider debouncing updates or only persisting changes on blur/save events.Best practices
- Debounce onChange: Use a debounce utility to limit API calls
- Memoize callbacks: Use
useCallbackfor onChange handlers - Lazy loading: Load the editor component lazily if not immediately needed
- Content size: For very large documents, consider pagination or lazy rendering
Browser support
The WebEditor supports all modern browsers:- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
Internet Explorer is not supported. The editor requires modern JavaScript features including ES6+ and Web APIs.
See also
- Components Overview - Learn about available built-in components
- useTheme Hook - Theme management utilities
- Quickstart Guide - Get started quickly