prosemirror-view

Renders ProseMirror editor state as a live, editable DOM tree and handles user input.

Library
npm
v1.42.2
2,040stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity8
Maintenance0
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture88
Code Quality82
Innovation80
Learning Curve55

prosemirror-view is the DOM rendering and event-handling layer of the ProseMirror rich-text editing toolkit. Given an EditorState, it produces and incrementally updates a contentEditable DOM tree, translating native browser input (keystrokes, IME composition, drag-and-drop, paste, mutation events) into ProseMirror transactions rather than trusting the DOM’s own editing behavior.

It is deliberately the only module in the ProseMirror ecosystem that touches the DOM, which lets prosemirror-state, prosemirror-model, and prosemirror-transform stay pure and platform-agnostic. Editors like TipTap and many custom document/CMS/chat editors depend on it directly or indirectly for reconciling model state with a contentEditable surface across Chrome, Firefox, and Safari quirks.

What You Get

  • EditorView: the core class that mounts, updates, and tears down the editable DOM representation of an EditorState
  • Decoration and DecorationSet APIs for annotating the rendered document (widgets, inline marks, node attributes) without touching the underlying document model
  • NodeView/MarkView interfaces for supplying fully custom DOM rendering and update logic per node or mark type (used for embeds, code blocks, custom widgets)
  • A DOMObserver-based reconciliation layer that reads native MutationObserver/selection events and reconciles them back into ProseMirror transactions
  • Cross-browser input normalization for IME composition, clipboard paste/copy, drag-and-drop, and key capture (Chrome/Firefox/Safari/mobile quirks handled internally)
  • Coordinate and position utilities (posAtCoords, coordsAtPos, endOfTextblock) for mapping between DOM geometry and document positions

Common Use Cases

  • Rendering a ProseMirror-based rich-text editor (as used by TipTap and many custom CMS/document editors) inside a web application
  • Building collaborative editing surfaces where remote transactions must be reflected in the live DOM without losing local selection or IME state
  • Embedding custom interactive widgets (mentions, tables, code blocks, inline comments) into a document via NodeView/decoration APIs
  • Implementing structured, schema-constrained editing experiences where arbitrary contentEditable behavior needs to be intercepted and normalized

Under The Hood

Architecture prosemirror-view sits as the sole DOM-touching layer of the ProseMirror stack: EditorView (src/index.ts, 825 lines) owns a docView tree of ViewDesc/NodeViewDesc/MarkView nodes (src/viewdesc.ts, 1590 lines) that mirror the document model into real DOM nodes, diffed and patched on each state update. A DOMObserver (src/domobserver.ts, 392 lines) wraps a native MutationObserver plus a SelectionState poll to catch DOM changes the editor didn’t itself make (autocorrect, IME, extensions) and routes them through readDOMChange (src/domchange.ts) back into transactions, closing the loop between imperative DOM mutation and ProseMirror’s immutable state model. Input handling (src/input.ts, 830 lines), key capture (src/capturekeys.ts), clipboard (src/clipboard.ts), and selection (src/selection.ts) are split into focused modules that all funnel into the same dispatchTransaction path, giving the module a clear unidirectional data flow: DOM event -> normalized transaction -> state update -> DOM patch.

Tech Stack Pure TypeScript (99.67% of the codebase) with zero runtime dependencies beyond the other ProseMirror core packages (prosemirror-model, prosemirror-state, prosemirror-transform, each pinned via caret ranges) — no bundler runtime, no framework binding baked in. It builds via the internal @prosemirror/buildhelper tool (pm-buildhelper) into dual ESM/CJS output (dist/index.js, dist/index.cjs) with generated .d.ts types, and ships a small companion style/prosemirror.css. Tests run through pm-runtests, a ProseMirror-specific runner, rather than a mainstream framework like Vitest or Jest.

Code Quality Test coverage is substantial for a low-level DOM-reconciliation library: 11 dedicated webtest-*.ts files (clipboard, composition, decoration, domchange, draw, draw-decoration, endOfTextblock, markview, nodeview, selection, view) totaling ~2,975 lines, run in real browsers given the DOM/selection/IME surface being tested. Source files are consistently typed with exported interfaces documented via ’///’ doc comments consumed by the ProseMirror doc-gen tooling, and internal-only members are explicitly marked ‘@internal’. Cross-browser workarounds (Chrome/Firefox/Safari/IE11 branches) are isolated behind a small browser.ts module rather than scattered inline, keeping the quirk-handling contained.

API Design The public surface centers on one class (EditorView) configured via a props object (DirectEditorProps), plus well-documented extension points (NodeView, MarkView, Decoration) that let consumers opt into custom rendering without reimplementing reconciliation. Getting started requires minimal boilerplate — new EditorView(place, {state}) — but correctly using the lower-level position/coordinate APIs (posAtCoords, coordsAtPos) and understanding the DOMObserver/transaction reconciliation model has a real learning curve, reflected in extensive prose documentation embedded as doc comments and the existence of a companion prosemirror.net documentation site with dedicated guides.

Used by 17 apps in this directory

TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
Swift
64%
GPL 3.0

cmux

Developer Tools · AI Development

26,221

A native, Ghostty-based macOS terminal with vertical tabs, agent-aware notifications, and a scriptable browser built for running many parallel AI coding agent sessions instead of juggling tmux panes.

View details
84
Repo Health
81
Technical
72
Dependency
Built with
Swift64%
Rust14%
Updated today
Ruby
62%
GPL 2.0

Discourse

Community

47,672

Open-source community platform with dynamic trust levels, real-time chat, and a powerful plugin architecture for self-hosted forums.

View details
89
Repo Health
89
Technical
67
Dependency
Built with
Ruby62%
JavaScript31%
Updated today
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
TypeScript
72%
Other

Epicenter

Knowledge Management · Note Taking · Developer Tools

4,761

A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.

View details
88
Repo Health
90
Technical
68
Dependency
Built with
TypeScript72%
Svelte15%
Updated today
TypeScript
76%
Other

Joplin

Note Taking

56,003

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
62
Dependency
Built with
TypeScript76%
JavaScript15%
Updated yesterday
Elixir
71%
AGPL 3.0

Keila

Marketing

2,188

Self-hosted newsletter platform with a visual block editor, Liquid personalization, and flexible email delivery — a privacy-respecting Mailchimp alternative you run on your own infrastructure.

View details
88
Repo Health
76
Technical
71
Dependency
Built with
Elixir71%
HTML18%
Updated yesterday
Scala
63%
AGPL 3.0

lila (Lichess)

Community

18,642

The forever-free, ad-free, open-source chess server powering millions of real-time games, AI analysis, puzzles, and tournaments worldwide.

View details
89
Repo Health
80
Technical
78
Dependency
Built with
Scala63%
TypeScript26%
Updated today
JavaScript
44%
Other

LimeSurvey

Forms Surveys

3,698

The world's most flexible open-source survey platform with 900+ templates, conditional logic, 80+ languages, and full GDPR compliance for any scale.

View details
86
Repo Health
62
Technical
62
Dependency
Built with
JavaScript44%
PHP34%
CSS12%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search