Skip to content

feat: decouple yjs from blocknote/core#2741

Draft
nperez0111 wants to merge 1 commit into
mainfrom
decouple-yjs
Draft

feat: decouple yjs from blocknote/core#2741
nperez0111 wants to merge 1 commit into
mainfrom
decouple-yjs

Conversation

@nperez0111
Copy link
Copy Markdown
Contributor

@nperez0111 nperez0111 commented May 13, 2026

Summary

In preparation of the upcoming Y.js 14. Which will introduce breaking changes on the API, type, package, and possibly document level.
I'm doing what we probably should have done from the start & de-coupling BlockNote from Y.js completely.
This means that when importing from @blocknote/core, we will no longer depend on anything in yjs or y-prosemirror.
Before this, certain functionality would import yjs or y-prosemirror at runtime even if the editor didn't actually need it's methods.

Now, to make your editor collaborative, you essentially just need to wrap your existing editor options with withCollaboration, for the editor to become collaborative.
This will automatically configure your editor to be collaborative, installing all of the necessary extensions to make the feature work.

Rationale

I'm fairly certain that we are going to need to support both Y.js 13 & Y.js 14 for some period of time. Since it will require document migrations at the discretion of the integrator.
So, it is better to get ahead of this & completely de-couple the editor from yjs & y-prosemirror.

Changes

This PR removes the tight coupling between Yjs and @blocknote/core by moving all Yjs-related code into a dedicated @blocknote/core/yjs subpath export.

Breaking Changes

collaboration is no longer a direct editor option. Instead, use the new withCollaboration() helper to wrap your editor options:

// Before
const editor = useCreateBlockNote({
  collaboration: { provider, fragment, user },
});

// After
import { withCollaboration } from "@blocknote/core/yjs";

const editor = useCreateBlockNote(
  withCollaboration({
    collaboration: { provider, fragment, user },
  }),
);

Yjs-related imports have moved:

Export Old path New path
YjsThreadStore @blocknote/core/comments @blocknote/core/yjs
RESTYjsThreadStore @blocknote/core/comments @blocknote/core/yjs
YjsThreadStoreBase @blocknote/core/comments @blocknote/core/yjs
ForkYDocExtension @blocknote/core/extensions @blocknote/core/yjs
YSyncExtension, YUndoExtension, YCursorExtension, SchemaMigration @blocknote/core/extensions @blocknote/core/yjs

Non-Yjs exports (CommentsExtension, DefaultThreadStoreAuth, TiptapThreadStore, etc.) remain in @blocknote/core/comments.

Impact

Now, @blocknote/core does not depend on yjs or y-prosemirror unless using the new @blocknote/core/yjs. Reducing bundle size & separating concerns better.

Testing

Screenshots/Video

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview May 14, 2026 5:55am
blocknote-website Error Error May 14, 2026 5:55am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5aec220f-6ba7-43ea-afa3-e42e45516cc6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch decouple-yjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 13, 2026

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2741

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2741

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2741

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2741

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2741

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2741

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2741

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2741

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2741

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2741

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2741

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2741

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2741

commit: f503fda

selection: {
prosemirror: {
head: number;
anchor: number;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was changed to not depend on yjs positions in the API. There are still ways to get it, this was just exposed in the API for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant