
Total Views
474
Read Time
20 min read
Updated On
18.09.2026
Introduction
How WYSIWYG Editors Work in 2026: A Developer's Deep-Dive Guide
How WYSIWYG editors actually work in 2026 — technical deep-dive covering the 4 core architectural layers (document model, rendering, editing, serialization), the 3 document model types (DOM-based, Virtual DOM, AST-based), modern editor architectures (Lexical, ProseMirror, Slate) compared, AI integration patterns (command-based, autocomplete, streaming transformations), CRDT vs OT real-time collaboration algorithms, security architecture (3-layer defense), and bundle size architecture. Working code examples for each concept. Real 2026 architectural comparisons.
TL;DR
How WYSIWYG editors work 2026: 4 architectural layers (document model, rendering, editing, serialization), 3 document model types, Lexical vs ProseMirror vs Slate, AI integration, CRDT collaboration.

Content
How WYSIWYG Editors Work in 2026: A Developer's Deep-Dive Guide
How WYSIWYG editors work in 2026 has changed significantly from the contenteditable-first designs of 2015-2020. Modern editors run on AST-based document models. Meta's Lexical powers WhatsApp Web with sub-16ms typing latency at billion-user scale. AI integration became architectural, not bolted on. And real-time collaboration via CRDTs replaced Operational Transforms as the dominant sync pattern.
Most "how WYSIWYG editors work" content stops at "contenteditable makes it editable." That's outdated by a decade. Real modern editors — Lexical, ProseMirror, Slate — are architectural frameworks with sophisticated document models, transaction systems, and rendering layers that fix contenteditable's cross-browser inconsistencies.
This guide is the technical deep-dive: how WYSIWYG editors actually work under the hood in 2026. The 4 core architectural layers. The 3 document model types. How modern architectures (Lexical, ProseMirror, Slate) differ. How AI integration works. How CRDT collaboration syncs multi-user edits. How bundle size and performance architecture affects Core Web Vitals. Written for developers who want to understand editors well enough to build one, evaluate one, or debug one intelligently.
Why How WYSIWYG Editors Work Matters More in 2026
Six architectural shifts made understanding editor internals more consequential this year:
Change | Date | Impact |
|---|---|---|
Meta's Lexical matured | 2022-2026 | Displaced Draft.js industry-wide |
AI integration became architectural | 2026 | Editor engines now designed for AI |
React 19 concurrent mode | Late 2025 | Editor state patterns changed |
CRDTs replaced OT dominance | 2024-2026 | Y.js became de facto standard |
INP replaced FID as CWV metric | March 2024 | Editor typing latency measurable |
Bundle size = SEO ranking factor | 2026 | Architecture choices affect rankings |
If you last learned how editors work before 2022, your mental model predates Lexical + Y.js + AI-first architecture — the three biggest editor architecture shifts this decade.
What This Guide Covers
- ✅ The 4 core architectural layers every WYSIWYG editor has
- ✅ The 3 document model types (DOM-based, Virtual DOM, AST-based)
- ✅ Modern editor architectures — Lexical, ProseMirror, Slate compared
- ✅ How AI integration works in modern editors
- ✅ How CRDT collaboration syncs multi-user edits (Y.js explained)
- ✅ Serialization patterns (HTML, JSON, Markdown)
- ✅ Bundle size + performance architecture
- ✅ Security architecture (sanitization, XSS prevention)
- ✅ 6 FAQ answers — deep technical questions
If you want the architectural comparisons, jump to Modern Editor Architectures or How AI Integration Works.
🎥 See a Lexical-based modern architecture in practice: What is Eddyter? Why Developers Are Switching in 2026
The Short Answer: How WYSIWYG Editors Work
At the highest level, every WYSIWYG editor has 4 architectural layers:
- Document Model — internal representation of content (DOM, Virtual DOM, or custom AST)
- Rendering Layer — converts document model → visible DOM
- Editing Layer — handles user input via contenteditable, Selection API, Range API
- Serialization Layer — converts document model ↔ HTML/JSON/Markdown for storage
Modern editors (Lexical, ProseMirror, Slate) use AST-based document models with immutable transactions — the same pattern React uses for UI rendering. This gives them: sub-16ms typing latency, predictable state, cross-browser consistency, and clean AI integration.
Legacy editors (early TinyMCE, Quill v1) use DOM-based models with direct DOM manipulation — simpler but plagued by cross-browser bugs, unpredictable state, and difficulty adding modern features like AI or CRDT collaboration.
The 4 Core Architectural Layers
Layer 1: Document Model
The document model is the internal representation of content. This is where WYSIWYG editors differ most fundamentally.
DOM-based Model (Legacy):
The visible DOM IS the document model. Edits directly manipulate DOM nodes.
Pros: Simple. Small bundle.
Cons: Cross-browser inconsistency. Difficult to validate structure. Hard to add features.
Virtual DOM Model:
An intermediate virtual DOM sits between user edits and actual DOM. Similar to React's approach.
Pros: Better performance. Predictable state.
Cons: More complex. Larger bundle.
AST-based Model (Modern):
A custom Abstract Syntax Tree represents content as typed nodes with validated schema.
Pros: Type-safe. Schema validation. Cross-browser consistency. AI-friendly. CRDT-compatible.
Cons: Larger bundle. Steeper learning curve.
Modern editors using AST-based models: Lexical (Meta), ProseMirror, Slate, TipTap (wraps ProseMirror), BlockNote (custom AST), Editor.js (custom AST).
Layer 2: Rendering Layer
The rendering layer converts document model → visible DOM.
In DOM-based editors: No separate rendering layer — DOM IS the model.
In AST-based editors: A dedicated renderer walks the AST and generates DOM nodes. This is where React 19 concurrent mode gains matter — modern editors use useSyncExternalStore for React state sync at 60fps.
Example (Lexical simplified):
typescript
Real implementations are more sophisticated (handle diffing, reconciliation, focus preservation) but this shows the core concept.
Layer 3: Editing Layer
The editing layer captures user input and translates it into document model changes.
Key browser APIs:
contenteditable— HTML attribute making elements editable- Selection API — get/set text selection (
window.getSelection()) - Range API — represent text ranges within DOM
- Input events —
beforeinput,input,compositionstart,compositionend
The contenteditable problem:
contenteditable behavior varies across browsers. Chrome, Firefox, Safari, and Edge all handle Enter key, list toggling, and paste events differently. Modern editors intercept these events and route them through their own transaction system to guarantee consistent behavior.
Modern editing flow (Lexical/ProseMirror):
This transaction-based approach fixes browser inconsistencies but adds architectural complexity.
Layer 4: Serialization Layer
The serialization layer converts document model ↔ external formats.
Common serialization targets:
- HTML — for storage, display, email
- JSON — for structured data, database storage
- Markdown — for documentation, GitHub content
- Plain text — for search indexing
Example (Lexical serialization):
typescript
Critical security note: Always sanitize output with DOMPurify before rendering user-generated content. Editor sanitization alone isn't enough — server-side sanitization is required. See Rich Text Editor Security Guide 2026.
<a id="architectures"></a>
Modern Editor Architectures Compared (2026)
Four modern architectures dominate the editor landscape in 2026:
Lexical (Meta, 2022+)
Foundation: Custom TypeScript editor framework
Document Model: Node-based AST with schema validation
Rendering: Selective updates via useSyncExternalStore (React 19 native)
Editing: Transaction system intercepting all input events
Bundle: ~90 KB core
Architectural innovations:
- Node classes with typed properties (TypeScript-first)
- Lazy rendering — only re-renders changed nodes
- Immutable transactions with rollback support
- Built for React 19 concurrent mode
Used by: Facebook Messenger, WhatsApp Web, Threads, Eddyter (managed Lexical), custom implementations.
ProseMirror (2016+)
Foundation: Vanilla JavaScript editor framework
Document Model: Schema-based AST with strict validation
Rendering: Custom rendering system framework-agnostic
Editing: Transaction/action system
Bundle: ~120 KB core
Architectural innovations:
- Schema definitions (nodes + marks)
- Transform system with reversibility
- Decoration system for visual annotations
- Framework-agnostic (works with React, Vue, vanilla)
Used by: New York Times, Confluence, Notion (customized ProseMirror), TipTap (wraps ProseMirror), NYT internal tools.
Slate (2018+)
Foundation: React-first editor framework
Document Model: Immutable JSON tree
Rendering: React components for each node type
Editing: React-based transaction system
Bundle: ~150 KB core
Architectural innovations:
- React-first API
- Immutable state with Immer patterns
- Plugin architecture with lifecycle hooks
- Extensively customizable node types
Used by: GitBook, Grafana, Plate (built on Slate).
Custom AST-Based (BlockNote, Editor.js)
Foundation: Custom document model implementations
Document Model: JSON-based blocks with typed content
Rendering: Framework-specific (React for BlockNote, vanilla for Editor.js)
Architectural innovations:
- Block-based UX (Notion-style)
- JSON output for structured content
- Plugin systems for extending block types
Used by: Notion clones, structured content platforms.
For deep comparison, see Lexical vs ProseMirror 2026, Best Lexical Alternative 2026, and ProseMirror vs TipTap 2026.
Why Meta Chose Lexical (And Why It Matters)
Meta deprecated Draft.js (their previous editor) in December 2022 and moved everything to Lexical. Understanding why explains where editor architecture is heading.
Draft.js problems Meta hit at scale:
- Immutable.js library overhead (~50 KB extra)
- Difficult to add new features (rigid architecture)
- Poor mobile performance
- Cross-browser inconsistencies at scale
Lexical solutions:
- No Immutable.js dependency (uses plain objects)
- Extensible node system (easy to add features)
- Sub-16ms typing latency at WhatsApp scale
- Consistent cross-browser via transaction interception
Real-world impact:
- WhatsApp Web handles 100+ billion messages/day using Lexical
- Facebook Messenger typing feels smoother
- Threads (Meta's Twitter competitor) launched with Lexical from day 1
Why this matters for you: If you're evaluating rich text editors, the architectural bet Meta made (custom TypeScript AST with transaction system) is now the industry direction. Choosing editors built on Lexical (managed like Eddyter, or custom Lexical implementations) inherits this proven architecture.
<a id="ai-integration"></a>
How AI Integration Works in Modern Editors (2026)
AI integration in editors became architectural, not bolted on, in 2026. Here's how it actually works.
The 3 AI Integration Patterns
Pattern 1: Command-Based (Chat Interface)
User invokes AI via command (like /ai write about React 19). Editor sends command + context to AI provider. AI returns text. Editor inserts as new content.
typescript
Pattern 2: Autocomplete (Inline Suggestions)
As user types, editor sends context to AI. AI returns predicted completion. Editor shows ghost text. User accepts with Tab.
typescript
Pattern 3: Streaming Transformations (Rewrite, Translate)
User selects text, invokes transformation (rewrite, translate, summarize). Editor streams AI response into selected region, replacing content in real-time.
typescript
The 4 Modern AI Models (2026)
Modern editors like Eddyter support multiple AI providers for different tasks:
- GPT-5 (OpenAI): Best reasoning, longest context, ideal for complex writing
- Claude Sonnet 5 (Anthropic): Best writing quality, tone matching, thoughtful responses
- Claude Haiku 4.5 (Anthropic): Fast + cheap, ideal for autocomplete and bulk operations
- Gemini 3 (Google): Best research + multimodal, cheapest for high-volume workloads
Multi-model architecture lets users pick best model per task. Custom AI integrations require 2-3 weeks per provider. Managed editors like Eddyter include all 4 models built in.
AI Prompt Injection Defense
New attack vector in 2026: attackers embed hidden prompts in editor content that manipulate AI when it processes the document.
Defense pattern:
typescript
For deeper security patterns, see Rich Text Editor Security Guide 2026.
How Real-Time Collaboration Works (CRDTs vs OT)
Two algorithms enable real-time multi-user editing: Operational Transforms (OT) and Conflict-Free Replicated Data Types (CRDTs).
Operational Transforms (Older, 1990s+)
How OT works:
- Each edit is an "operation" (insert character at position 5)
- When two users edit simultaneously, server transforms operations to preserve intent
- Transformed operations applied in consistent order across all clients
Pros: Compact operations (small network payload). Well-understood.
Cons: Requires central server for transformation. Complex to implement correctly.
Used by: Google Docs, older Confluence.
CRDTs (Modern, 2010s+)
How CRDTs work:
- Each edit generates a mathematically unique operation ID
- Operations can be applied in any order and always converge to same state
- Peer-to-peer sync possible (no central server required)
Pros: Decentralized. Simpler mental model. Offline support built in.
Cons: Larger metadata per operation.
Used by: Modern editors via Y.js, Automerge, Yjs implementations.
Y.js — The De Facto CRDT for Editors in 2026
Y.js is a JavaScript CRDT library that dominates modern editor collaboration. Works with Lexical, ProseMirror, Slate, TipTap, and BlockNote.
Basic Y.js integration:
typescript
Multi-user editing with real-time cursor positions, presence indicators, and undo/redo per user — all handled automatically by the CRDT algorithm.
For managed collaboration: TipTap Cloud, Liveblocks, Eddyter (Q3 2026 native RTC launching). Managed services handle server infrastructure, presence tracking, and edge cases.
Bundle Size + Performance Architecture
Modern editor architecture directly affects bundle size and Core Web Vitals.
Bundle Size Comparison (Gzipped)
Editor | Bundle | Architecture |
|---|---|---|
Quill | ~45 KB | DOM-based (legacy) |
Editor.js | ~50 KB | Custom AST (blocks) |
Lexical core | ~90 KB | Custom AST (Meta) |
ProseMirror core | ~120 KB | Schema-based AST |
Eddyter | ~140 KB | Lexical + AI + tables + mobile UX |
Slate core | ~150 KB | React-first AST |
TipTap starter | ~165 KB | ProseMirror wrapper |
BlockNote | ~180 KB | Custom AST (blocks) |
CKEditor 5 | ~500 KB | Custom TypeScript (comprehensive) |
TinyMCE | ~500 KB | Legacy DOM + Virtual DOM hybrid |
Performance Architecture
Sub-16ms typing latency requires:
- Selective re-rendering — only update changed nodes (Lexical, React 19)
useSyncExternalStore— React 19's proper external state sync API- Efficient AST diffing — modern AST-based editors optimize for common edits
- Debounced transactions — batch multiple keystrokes into single transaction
Legacy DOM-based editors typically hit 30-50ms latency at large document sizes. Modern AST-based editors stay under 16ms consistently.
For deep performance analysis, see Rich Text Editor Performance Benchmarks 2026.
Security Architecture
Editor security architecture has 3 layers of defense.
Layer 1: Input Sanitization
When users paste content or type, editor sanitizes input:
typescript
Layer 2: Output Serialization
When serializing to HTML for storage, editor removes potentially dangerous content:
typescript
Layer 3: Server-Side Sanitization (Critical)
Client-side sanitization can be bypassed. Server MUST sanitize before storage:
typescript
For comprehensive security patterns, see Rich Text Editor Security Guide 2026.
Editor Selection by Architecture
For Custom Editor Products (Editor IS Your Product)
Pick Lexical + custom (Meta's framework) or ProseMirror + custom (10 years battle-tested). Full architectural control. See Best Lexical Alternative 2026.
For Managed Modern Architecture
Pick Eddyter. Lexical foundation + AI + collaboration + 7-framework support. No architectural work needed.
For React-Only Products With Custom Architecture
Pick Slate + custom or Lexical + custom. React-first design.
For Notion-Style Block Products
Pick BlockNote (React-only) or Editor.js (framework-agnostic).
For Enterprise With Compliance Requirements
Pick CKEditor 5. Comprehensive architecture + SOC 2 + WCAG 2.1 AA audited. See Best CKEditor Alternative 2026.
For Legacy Migration
Migrate to Lexical. Meta's official successor to Draft.js. Modern architecture. See How to Migrate From TinyMCE to a Modern Editor 2026.
Frequently Asked Questions
1. How does a WYSIWYG editor actually work under the hood?
Modern WYSIWYG editors have 4 architectural layers: (1) Document Model — internal representation as DOM, Virtual DOM, or custom AST. Modern editors use AST-based models (Lexical, ProseMirror, Slate) for type safety and consistency. (2) Rendering Layer — converts document model → visible DOM. React 19-native editors use useSyncExternalStore for 60fps rendering. (3) Editing Layer — captures user input via contenteditable, Selection API, Range API, and beforeinput events. Modern editors intercept these events and route through transaction systems for cross-browser consistency. (4) Serialization Layer — converts document model ↔ HTML/JSON/Markdown for storage. Complete architectural walkthrough shown above with code examples for each layer.
2. What's the difference between DOM-based, Virtual DOM, and AST-based editor architectures?
DOM-based (legacy, e.g. Quill v1): The visible DOM IS the document model. Simple but plagued by cross-browser bugs. Virtual DOM: Intermediate virtual representation sits between edits and DOM. Better performance than pure DOM manipulation. AST-based (modern, e.g. Lexical, ProseMirror, Slate): Custom Abstract Syntax Tree with typed nodes and schema validation. Cross-browser consistency, AI-friendly, CRDT-compatible, and enables sub-16ms typing latency. Modern editors have moved to AST-based models — Meta deprecated Draft.js and moved WhatsApp Web + Facebook Messenger to Lexical (AST-based) for this reason. For serious modern editors in 2026, AST-based is the industry direction.
3. Why did Meta build Lexical if ProseMirror already existed?
Meta needed sub-16ms typing latency at WhatsApp scale (100+ billion messages/day). Draft.js (their previous editor) had architectural limits: Immutable.js dependency (~50 KB overhead), rigid architecture making features difficult to add, poor mobile performance. Lexical was built specifically to fix these: no Immutable.js dependency (uses plain objects), extensible node system, sub-16ms typing latency proven at Meta scale, cross-browser consistency via transaction interception. Meta uses Lexical in Facebook Messenger, WhatsApp Web, and Threads — proving it at billion-user scale. ProseMirror is excellent but more complex; Lexical is optimized for messaging-scale performance. Eddyter is built on Lexical, inheriting this Meta-tested architecture at $12-$59/mo flat.
4. How does AI integration work in modern WYSIWYG editors?
Three patterns dominate. Pattern 1: Command-based (chat) — user invokes /ai command, editor sends command + context to AI, inserts response as new content. Pattern 2: Autocomplete — as user types, editor sends context to AI, receives predicted completion, shows ghost text (user accepts with Tab). Pattern 3: Streaming transformations — user selects text, invokes rewrite/translate/summarize, editor streams AI response replacing selection in real-time. Modern editors support multiple AI models: GPT-5 for reasoning, Claude Sonnet 5 for writing quality, Claude Haiku 4.5 for fast autocomplete, Gemini 3 for research. Custom AI integration requires 2-3 weeks per provider. Managed editors like Eddyter include all 4 models built in. Working code for all three patterns shown above.
5. How does real-time collaboration work in editors (CRDTs vs OT)?
Two algorithms enable multi-user editing. Operational Transforms (OT, 1990s+): Each edit is an operation (e.g. "insert 'x' at position 5"). When users edit simultaneously, server transforms operations to preserve intent. Used by Google Docs, older Confluence. Compact operations but requires central server. CRDTs (Conflict-Free Replicated Data Types, 2010s+): Each edit generates mathematically unique operation ID. Operations can be applied in any order and always converge to same state. Peer-to-peer sync possible. Used by modern editors via Y.js. Y.js has become the de facto CRDT for editor collaboration in 2026 — works with Lexical, ProseMirror, Slate, TipTap. For managed collaboration: TipTap Cloud, Liveblocks, or Eddyter (Q3 2026 native RTC launching). Basic Y.js integration code shown above.
6. What's the smallest bundle size WYSIWYG editor I should use?
Quill (~45 KB) has the smallest bundle but uses legacy DOM-based architecture and development stalled since 2022. Editor.js (~50 KB) is close but uses JSON output requiring HTML transformation. Lexical core (~90 KB) is smallest modern AST-based option — Meta's framework, React 19 native. For production-ready complete editor with AI + tables + mobile UX, Eddyter (~140 KB) is smallest. Under 200 KB is safe for Core Web Vitals (Google ranking factor). Over 500 KB (CKEditor, TinyMCE) hurts SEO significantly — a ~500 KB editor bundle can drop search rankings 3-5 positions vs ~140 KB equivalents. Bundle size decisions have direct SEO revenue impact. See Rich Text Editor Performance Benchmarks 2026 for full performance data.
Ready to Ship a Modern Rich Text Editor?
Understanding WYSIWYG editor architecture is the foundation for good editor decisions. For most React SaaS teams in 2026, building on a modern AST-based foundation (Lexical, ProseMirror) is the right architectural choice — but building takes 4-8 weeks minimum.
- 🥇 Eddyter for managed modern architecture — Lexical foundation + AI + 7-framework, $12-$59/mo flat, 10 minutes
- 🥈 Lexical + custom for full architectural control — Free MIT, 4-6 weeks
- 🥉 ProseMirror + custom for battle-tested framework-agnostic — Free MIT, 6-8 weeks
For most modern React SaaS teams in 2026, Eddyter delivers Meta's Lexical architecture + multi-model AI + mobile-first UX + 7-framework support at flat pricing.
👉 Try Eddyter free at eddyter.com
📚 Read the docs
💰 See pricing
🎥 Watch the intro video | Watch the 30-min integration guide

Written by
Shreya Taneja
Project Manager

