How prosemirror/prosemirror-state works
Main Component Identification
a) State Management Core
• EditorState (from state.ts)
• Transaction System (from transaction.ts)
• Selection Management (from selection.ts)
• Plugin System (from plugin.ts)
Detailed Component Breakdown
For each major component, include:
a) EditorState:
• Document state
• Selection state
• Plugin state
• State configuration
b) Transaction System:
• Transaction creation
• State updates
• Change tracking
c) Selection Management:
• Selection ranges
• Cursor positions
• Selection updates
d) Plugin System:
• Plugin registry
• State extensions
• Event hooks
Interaction Patterns
Following relationships:
┌─────────────────────────────────────────┐
• ProseMirror State │
• ┤
• ┌──────────┐ ┌──────────┐ │
• State ◄────────┤ Trans- │ │
• action │ │
• ┬───┘ └──────────┘ │
• ▼ │
• ┌──────────┐ ┌──────────┐ │
• Selection │◄───────┤ Plugins │ │
• ┘ └──────────┘ │
• ┘
Technical Details
• State immutability patterns
• Transaction application flow
• Plugin lifecycle hooks
• Selection update mechanisms
Integration Context
How this module interfaces with:
• Other ProseMirror core modules
• External plugin systems
• Document schema handling