prosemirror-view

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

Library
npm
v1.42.6
2,038 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
43 /100 Fair
Development Activity 4
Maintenance 0
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 88
Code Quality 82
Innovation 80
Learning Curve 55

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 19 apps in this directory

TypeScript
54%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,404

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
68
Dependency
Built with
TypeScript 54%
Rust 34%
Updated 4 days ago
Swift
62%
GPL 3.0

cmux

AI Development · Developer Tools

27,452

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
69
Dependency
Built with
Swift 62%
Rust 13%
Updated 4 days ago
Ruby
61%
GPL 2.0

Discourse

Community

47,915

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
Ruby 61%
JavaScript 32%
Updated 4 days ago
TypeScript
92%
MIT

Dittofeed

Automation · Marketing

2,968

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
62
Dependency
Built with
TypeScript 92%
Updated 6 months ago
TypeScript
64%
Other

Epicenter

Developer Tools · Knowledge Management · Note Taking

4,808

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
64
Dependency
Built with
TypeScript 64%
HTML 13%
Svelte 13%
Updated 5 days ago
TypeScript
77%
Other

Joplin

Note Taking

56,513

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
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated 5 days ago
Elixir
71%
AGPL 3.0

Keila

Marketing

2,224

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
84
Repo Health
76
Technical
72
Dependency
Built with
Elixir 71%
HTML 18%
Updated 1 weeks ago
Scala
63%
AGPL 3.0

lila (Lichess)

Community

18,776

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
76
Dependency
Built with
Scala 63%
TypeScript 26%
Updated 4 days ago
JavaScript
43%
Other

LimeSurvey

Forms Surveys

3,736

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
63
Dependency
Built with
JavaScript 43%
PHP 35%
CSS 12%
Updated 5 days ago

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