@lexical/react/LexicalCollaborationContext
Type Aliases
CollaborationContextType
CollaborationContextType =
object
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx: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/LexicalCollaborationContext.tsx:20
isCollabActive
isCollabActive:
boolean
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx:21
name
name:
string
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx:22
yjsDocMap
yjsDocMap:
Map<string,Doc>
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx:23
Variables
CollaborationContext
constCollaborationContext:Context<CollaborationContextType|null>
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx:52
The React context that holds the shared CollaborationContextType for collaborative editors. Provide it with LexicalCollaboration and read it with useCollaborationContext.
Functions
LexicalCollaboration()
LexicalCollaboration(
__namedParameters):Element
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx:76
A provider component that creates a fresh CollaborationContextType and makes it available to descendant editors via CollaborationContext. Wrap a group of editors that should share collaboration state in this component.
Parameters
__namedParameters
children
ReactNode
Returns
Element
A context provider wrapping children.
useCollaborationContext()
useCollaborationContext(
username?,color?):CollaborationContextType
Defined in: packages/lexical-react/src/LexicalCollaborationContext.tsx: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
The active collaboration context.