Skip to content

CollaborationPlugin - InitialEditorState from lexical not being called, #942

@willfeerr

Description

@willfeerr

Description
When starting a lexical new document, initialEditorState always been populated with a empty document, then we cant add a boilerplate on initialEditorState

Steps to reproduce the bug
Steps to reproduce the behavior:

  1. Any template from Lexical with Collaboration pluggin code

Expected behavior
When new page/document is created, on HocuspocusWebsocketProvider or wiht HocuspocusProvider

Environment?

  • operating system: win64
  • browser: edge-chromium
  • mobile/desktop: desktop
  • Hocuspocus version: 3.1.0

Additional context

<CollaborationPlugin
          id={id}
          providerFactory={providerFactory}
          // Optional initial editor state in case collaborative Y.Doc won't
          // have any existing data on server. Then it'll use this value to populate editor.
          // It accepts same type of values as LexicalfgfComposer editorState
          // prop (json string, state object, or a function)
          initialEditorState={(editor) => {
            console.log("3ditor", editor)
          }}

          shouldBootstrap={true}
          cursorsContainerRef={cursorsContainerRef}
          username={provider?.awareness?.getLocalState()?.name}
          cursorColor={provider?.awareness?.getLocalState()?.color}
        />

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions