Skip to content

Yjs

Make the editor collaborative by integrating Yjs with ProseKit.

Usage

You need to install yjs and y-prosemirror to use this extension.

shell
npm install yjs y-prosemirror
shell
yarn add yjs y-prosemirror
shell
pnpm add yjs y-prosemirror
ts
import 'prosekit/extensions/yjs/style.css'
import * as 
Y
from 'yjs'
import {
defineYjs
} from 'prosekit/extensions/yjs'
import {
WebsocketProvider
} from 'y-websocket'
const
doc
= new
Y
.
Doc
()
const
provider
= new
WebsocketProvider
(
'ws://localhost:1234', 'my-roomname',
doc
,
) const
extension
=
defineYjs
({
doc
,
awareness
:
provider
.
awareness
})

API Reference