Major Changes
-
- Add multi-provider support for improved collaboration: now supports both Hocuspocus and WebRTC simultaneously using a shared Y.Doc.
- Migration: Replace
hocuspocusProviderOptions
with the newproviders
array. See examples below.
- Migration: Replace
Before:
YjsPlugin.configure({ options: { cursorOptions: { /* ... */ }, hocuspocusProviderOptions: { url: 'wss://hocuspocus.example.com', name: 'document-1', // ... other Hocuspocus options }, }, });
After (Hocuspocus only):
YjsPlugin.configure({ options: { cursors: { /* ... */ }, providers: [ { type: 'hocuspocus', options: { url: 'wss://hocuspocus.example.com', name: 'document-1', // ... other Hocuspocus options }, }, ], }, });
After (Hocuspocus + WebRTC):
YjsPlugin.configure({ options: { cursors: { /* ... */ }, providers: [ { type: 'hocuspocus', options: { url: 'wss://hocuspocus.example.com', name: 'document-1', }, }, { type: 'webrtc', options: { roomName: 'document-1', // signaling: ['wss://signaling.example.com'], // Optional }, }, ], }, });
- Introduces
UnifiedProvider
interface that enables custom provider implementations (e.g., IndexedDB for offline persistence). - Renamed
cursorOptions
tocursors
. - Merged
yjsOptions
intooptions
.- Migration: Move options previously under
yjsOptions
directly into the mainoptions
object.
- Migration: Move options previously under
- Removed
YjsAboveEditable
. You should now callinit
anddestroy
manually:
React.useEffect(() => { if (!mounted) return; // Initialize Yjs connection and sync editor.getApi(YjsPlugin).yjs.init({ id: roomName, // Or your document identifier value: INITIAL_VALUE, // Your initial editor content }); // Destroy connection on component unmount return () => { editor.getApi(YjsPlugin).yjs.destroy(); }; }, [editor, mounted, roomName]); // Add relevant dependencies
- Add multi-provider support for improved collaboration: now supports both Hocuspocus and WebRTC simultaneously using a shared Y.Doc.