Skip to main content

@lexical/react/LexicalCollaborationContextUtils

Type Aliases​

CollaborationContextType​

CollaborationContextType = object

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:19

The value stored in the CollaborationContext: the local user's display name and cursor color, whether collaboration is currently active, and the map of Yjs documents shared by the editors under this provider.

Properties​

color​

color: string

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:20

isCollabActive​

isCollabActive: boolean

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:21

name​

name: string

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:22

yjsDocMap​

yjsDocMap: Map<string, Doc>

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:23

Variables​

CollaborationContext​

const CollaborationContext: Context<CollaborationContextType | null>

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:62

The React context that holds the shared CollaborationContextType for collaborative editors. Provide it with LexicalCollaboration and read it with useCollaborationContext.

Functions​

useCollaborationContext()​

useCollaborationContext(username?, color?): CollaborationContextType

Defined in: packages/lexical-react/src/LexicalCollaborationContextUtils.ts:93

Reads the current CollaborationContextType from the nearest LexicalCollaboration provider. Optionally pass username and color to set the local user's display name and cursor color.

Parameters​

username?​

string

color?​

string

Returns​

CollaborationContextType

The active collaboration context.