npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jazz-richtext-prosemirror

v0.14.28

Published

ProseMirror integration for Jazz rich text editing

Readme

Jazz ProseMirror Rich-text Integration

Integration between ProseMirror and Jazz's collaborative text value CoRichText, enabling real-time collaborative rich text editing in your applications.

Installation

pnpm add jazz-richtext-prosemirror prosemirror-view prosemirror-state prosemirror-schema-basic
# or
npm install jazz-richtext-prosemirror prosemirror-view prosemirror-state prosemirror-schema-basic
# or
yarn add jazz-richtext-prosemirror prosemirror-view prosemirror-state prosemirror-schema-basic

Features

  • Bidirectional Synchronization: Changes in ProseMirror automatically update Jazz's CoRichText and vice versa
  • Conflict Resolution: Uses Jazz's CRDT algorithms to handle concurrent edits gracefully
  • Rich Text Support: Full support for formatting, links, and other rich text features
  • Efficient Updates: Only sends minimal changes between components

Basic Usage

import { useAccount } from "jazz-react";
import { createJazzPlugin } from "jazz-richtext-prosemirror";
import { exampleSetup } from "prosemirror-example-setup";
import { schema } from "prosemirror-schema-basic";
import { EditorState } from "prosemirror-state";
import { EditorView } from "prosemirror-view";
import { useEffect, useRef } from "react";

function RichTextEditor() {
  // Access the user account with the bio field
  const { me } = useAccount({ resolve: { profile: true } });
  const editorRef = useRef<HTMLDivElement>(null);
  const viewRef = useRef<EditorView | null>(null);

  useEffect(() => {
    if (!me || !editorRef.current || !me.profile.bio) return;

    // Create the Jazz plugin with the CoRichText instance from the account
    const jazzPlugin = createJazzPlugin(me.profile.bio);

    // Set up ProseMirror with the Jazz plugin
    if (!viewRef.current) {
      viewRef.current = new EditorView(editorRef.current, {
        state: EditorState.create({
          schema,
          plugins: [...exampleSetup({ schema }), jazzPlugin],
        }),
      });
    }

    return () => {
      if (viewRef.current) {
        viewRef.current.destroy();
        viewRef.current = null;
      }
    };
  }, [me?.id, me?.profile.bio?.id]);

  if (!me) return null;

  return <div ref={editorRef} className="border rounded p-2" />;
}

API Reference

createJazzPlugin(coRichText, config?)

Creates a ProseMirror plugin that syncs with a Jazz CoRichText instance.

Parameters:

  • coRichText: The CoRichText instance to synchronize with
  • config (optional): Configuration options
    • showDecorations: Whether to show caret and selection decorations (default: false)

Returns:

  • A ProseMirror plugin instance that can be added to your editor

How it works

This package handles:

  1. Conversion: Transforms between HTML (used by Jazz) and ProseMirror's document model
  2. Change Tracking: Detects changes in both systems and applies them to the other
  3. Conflict Resolution: Leverages Jazz's CRDT algorithms for handling concurrent edits
  4. Efficiency: Only updates the necessary parts of documents when changes occur

Under the hood, it uses:

  • htmlToProseMirror and proseMirrorToHtml to convert between formats
  • ProseMirror transactions to track editor changes
  • CoRichText.applyDiff() for efficient updates

Complete Example

See the richtext example for a complete implementation demonstrating:

  • Side-by-side plaintext and rich text editing
  • Real-time collaboration
  • Persistent storage

License

MIT