Lexical text editor

Got this working after some diving into undocumented code. Here’s an example plugin instantiation:

{/* import { CollaborationPlugin } from "@lexical/react/LexicalCollaborationPlugin"; */}
<CollaborationPlugin
  id="test1"
  providerFactory={(id, yjsDocMap) => {
    
    const doc = new Y.Doc();
    yjsDocMap.set(id, doc);

    // const provider = new WebrtcProvider(id, doc);
    const provider = new WebsocketProvider(
      "ws://localhost:1234",
      id,
      doc
    );

    return provider;
  }}
  shouldBootstrap={true}
/>
3 Likes