feat: decouple yjs from blocknote/core#2741
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
| selection: { | ||
| prosemirror: { | ||
| head: number; | ||
| anchor: number; |
There was a problem hiding this comment.
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
e44394d to
17ab49f
Compare
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 inyjsory-prosemirror.Before this, certain functionality would import
yjsory-prosemirrorat 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/coreby moving all Yjs-related code into a dedicated@blocknote/core/yjssubpath export.Breaking Changes
collaborationis no longer a direct editor option. Instead, use the newwithCollaboration()helper to wrap your editor options:Yjs-related imports have moved:
YjsThreadStore@blocknote/core/comments@blocknote/core/yjsRESTYjsThreadStore@blocknote/core/comments@blocknote/core/yjsYjsThreadStoreBase@blocknote/core/comments@blocknote/core/yjsForkYDocExtension@blocknote/core/extensions@blocknote/core/yjsYSyncExtension,YUndoExtension,YCursorExtension,SchemaMigration@blocknote/core/extensions@blocknote/core/yjsNon-Yjs exports (
CommentsExtension,DefaultThreadStoreAuth,TiptapThreadStore, etc.) remain in@blocknote/core/comments.Impact
Now,
@blocknote/coredoes not depend onyjsory-prosemirrorunless using the new@blocknote/core/yjs. Reducing bundle size & separating concerns better.Testing
Screenshots/Video
Checklist
Additional Notes