Skip to main content

@lexical/yjs

Interfaces​

BaseBinding​

Defined in: packages/lexical-yjs/src/Bindings.ts:26

Extended by​

Properties​

clientID​

clientID: number

Defined in: packages/lexical-yjs/src/Bindings.ts:27

cursorHighlightSheet​

cursorHighlightSheet: CSSStyleSheet | null

Defined in: packages/lexical-yjs/src/Bindings.ts:34

For remote cursors, we lazily create stylesheet that hosts the ::highlight(...) rules. Editors mounted in different frames each adopt the sheet into their own document.

cursors​

cursors: Map<number, Cursor>

Defined in: packages/lexical-yjs/src/Bindings.ts:28

cursorsContainer​

cursorsContainer: HTMLElement | null

Defined in: packages/lexical-yjs/src/Bindings.ts:29

doc​

doc: Doc

Defined in: packages/lexical-yjs/src/Bindings.ts:35

docMap​

docMap: Map<string, Doc>

Defined in: packages/lexical-yjs/src/Bindings.ts:36

editor​

editor: LexicalEditor

Defined in: packages/lexical-yjs/src/Bindings.ts:37

excludedProperties​

excludedProperties: ExcludedProperties

Defined in: packages/lexical-yjs/src/Bindings.ts:40

id​

id: string

Defined in: packages/lexical-yjs/src/Bindings.ts:38

nodeProperties​

nodeProperties: Map<string, {[property: string]: unknown; }>

Defined in: packages/lexical-yjs/src/Bindings.ts:39


Binding​

Defined in: packages/lexical-yjs/src/Bindings.ts:43

Extends​

Properties​

clientID​

clientID: number

Defined in: packages/lexical-yjs/src/Bindings.ts:27

Inherited from​

BaseBinding.clientID

collabNodeMap​

collabNodeMap: Map<string, CollabElementNode | CollabTextNode | CollabDecoratorNode | CollabLineBreakNode>

Defined in: packages/lexical-yjs/src/Bindings.ts:44

cursorHighlightSheet​

cursorHighlightSheet: CSSStyleSheet | null

Defined in: packages/lexical-yjs/src/Bindings.ts:34

For remote cursors, we lazily create stylesheet that hosts the ::highlight(...) rules. Editors mounted in different frames each adopt the sheet into their own document.

Inherited from​

BaseBinding.cursorHighlightSheet

cursors​

cursors: Map<number, Cursor>

Defined in: packages/lexical-yjs/src/Bindings.ts:28

Inherited from​

BaseBinding.cursors

cursorsContainer​

cursorsContainer: HTMLElement | null

Defined in: packages/lexical-yjs/src/Bindings.ts:29

Inherited from​

BaseBinding.cursorsContainer

doc​

doc: Doc

Defined in: packages/lexical-yjs/src/Bindings.ts:35

Inherited from​

BaseBinding.doc

docMap​

docMap: Map<string, Doc>

Defined in: packages/lexical-yjs/src/Bindings.ts:36

Inherited from​

BaseBinding.docMap

editor​

editor: LexicalEditor

Defined in: packages/lexical-yjs/src/Bindings.ts:37

Inherited from​

BaseBinding.editor

excludedProperties​

excludedProperties: ExcludedProperties

Defined in: packages/lexical-yjs/src/Bindings.ts:40

Inherited from​

BaseBinding.excludedProperties

id​

id: string

Defined in: packages/lexical-yjs/src/Bindings.ts:38

Inherited from​

BaseBinding.id

nodeProperties​

nodeProperties: Map<string, {[property: string]: unknown; }>

Defined in: packages/lexical-yjs/src/Bindings.ts:39

Inherited from​

BaseBinding.nodeProperties

root​

root: CollabElementNode

Defined in: packages/lexical-yjs/src/Bindings.ts:51


BindingV2​

Defined in: packages/lexical-yjs/src/Bindings.ts:54

Extends​

Properties​

clientID​

clientID: number

Defined in: packages/lexical-yjs/src/Bindings.ts:27

Inherited from​

BaseBinding.clientID

cursorHighlightSheet​

cursorHighlightSheet: CSSStyleSheet | null

Defined in: packages/lexical-yjs/src/Bindings.ts:34

For remote cursors, we lazily create stylesheet that hosts the ::highlight(...) rules. Editors mounted in different frames each adopt the sheet into their own document.

Inherited from​

BaseBinding.cursorHighlightSheet

cursors​

cursors: Map<number, Cursor>

Defined in: packages/lexical-yjs/src/Bindings.ts:28

Inherited from​

BaseBinding.cursors

cursorsContainer​

cursorsContainer: HTMLElement | null

Defined in: packages/lexical-yjs/src/Bindings.ts:29

Inherited from​

BaseBinding.cursorsContainer

doc​

doc: Doc

Defined in: packages/lexical-yjs/src/Bindings.ts:35

Inherited from​

BaseBinding.doc

docMap​

docMap: Map<string, Doc>

Defined in: packages/lexical-yjs/src/Bindings.ts:36

Inherited from​

BaseBinding.docMap

editor​

editor: LexicalEditor

Defined in: packages/lexical-yjs/src/Bindings.ts:37

Inherited from​

BaseBinding.editor

excludedProperties​

excludedProperties: ExcludedProperties

Defined in: packages/lexical-yjs/src/Bindings.ts:40

Inherited from​

BaseBinding.excludedProperties

id​

id: string

Defined in: packages/lexical-yjs/src/Bindings.ts:38

Inherited from​

BaseBinding.id

mapping​

mapping: CollabV2Mapping

Defined in: packages/lexical-yjs/src/Bindings.ts:55

nodeProperties​

nodeProperties: Map<string, {[property: string]: unknown; }>

Defined in: packages/lexical-yjs/src/Bindings.ts:39

Inherited from​

BaseBinding.nodeProperties

root​

root: YXmlElement

Defined in: packages/lexical-yjs/src/Bindings.ts:56


Provider​

Defined in: packages/lexical-yjs/src/index.ts:57

Properties​

awareness​

awareness: ProviderAwareness

Defined in: packages/lexical-yjs/src/index.ts:58

Methods​

connect()​

connect(): void | Promise<void>

Defined in: packages/lexical-yjs/src/index.ts:59

Returns​

void | Promise<void>

disconnect()​

disconnect(): void

Defined in: packages/lexical-yjs/src/index.ts:60

Returns​

void

off()​
Call Signature​

off(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:61

Parameters​
type​

"sync"

cb​

(isSynced) => void

Returns​

void

Call Signature​

off(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:62

Parameters​
type​

"update"

cb​

(arg0) => void

Returns​

void

Call Signature​

off(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:63

Parameters​
type​

"status"

cb​

(arg0) => void

Returns​

void

Call Signature​

off(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:64

Parameters​
type​

"reload"

cb​

(doc) => void

Returns​

void

on()​
Call Signature​

on(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:65

Parameters​
type​

"sync"

cb​

(isSynced) => void

Returns​

void

Call Signature​

on(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:66

Parameters​
type​

"status"

cb​

(arg0) => void

Returns​

void

Call Signature​

on(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:67

Parameters​
type​

"update"

cb​

(arg0) => void

Returns​

void

Call Signature​

on(type, cb): void

Defined in: packages/lexical-yjs/src/index.ts:68

Parameters​
type​

"reload"

cb​

(doc) => void

Returns​

void

Type Aliases​

ClientID​

ClientID = number

Defined in: packages/lexical-yjs/src/Bindings.ts:25


Delta​

Delta = Operation[]

Defined in: packages/lexical-yjs/src/index.ts:76


ExcludedProperties​

ExcludedProperties = Map<Klass<LexicalNode>, Set<string>>

Defined in: packages/lexical-yjs/src/Bindings.ts:61


Operation​

Operation = object

Defined in: packages/lexical-yjs/src/index.ts:70

Properties​

attributes​

attributes: object

Defined in: packages/lexical-yjs/src/index.ts:71

__type​

__type: string

insert​

insert: string | Record<string, unknown>

Defined in: packages/lexical-yjs/src/index.ts:74


ProviderAwareness​

ProviderAwareness = object

Defined in: packages/lexical-yjs/src/index.ts:49

Properties​

getLocalState​

getLocalState: () => UserState | null

Defined in: packages/lexical-yjs/src/index.ts:50

Returns​

UserState | null

getStates​

getStates: () => Map<number, UserState>

Defined in: packages/lexical-yjs/src/index.ts:51

Returns​

Map<number, UserState>

off​

off: (type, cb) => void

Defined in: packages/lexical-yjs/src/index.ts:52

Parameters​
type​

"update"

cb​

() => void

Returns​

void

on​

on: (type, cb) => void

Defined in: packages/lexical-yjs/src/index.ts:53

Parameters​
type​

"update"

cb​

() => void

Returns​

void

setLocalState​

setLocalState: (arg0) => void

Defined in: packages/lexical-yjs/src/index.ts:54

Parameters​
arg0​

UserState | null

Returns​

void

setLocalStateField​

setLocalStateField: (field, value) => void

Defined in: packages/lexical-yjs/src/index.ts:55

Parameters​
field​

string

value​

unknown

Returns​

void


SyncCursorPositionsFn​

SyncCursorPositionsFn = (binding, provider, options?) => void

Defined in: packages/lexical-yjs/src/SyncCursors.ts:861

Parameters​

binding​

AnyBinding

provider​

Provider

options?​

SyncCursorPositionsOptions

Returns​

void


UserState​

UserState = object

Defined in: packages/lexical-yjs/src/index.ts:25

Indexable​

[key: string]: unknown

Properties​

anchorPos​

anchorPos: null | RelativePosition

Defined in: packages/lexical-yjs/src/index.ts:26

awarenessData​

awarenessData: object

Defined in: packages/lexical-yjs/src/index.ts:31

color​

color: string

Defined in: packages/lexical-yjs/src/index.ts:27

focusing​

focusing: boolean

Defined in: packages/lexical-yjs/src/index.ts:28

focusPos​

focusPos: null | RelativePosition

Defined in: packages/lexical-yjs/src/index.ts:29

name​

name: string

Defined in: packages/lexical-yjs/src/index.ts:30


YjsEvent​

YjsEvent = Record<string, unknown>

Defined in: packages/lexical-yjs/src/index.ts:78


YjsNode​

YjsNode = Record<string, unknown>

Defined in: packages/lexical-yjs/src/index.ts:77

Variables​

CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL​

const CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL: LexicalCommand<void>

Defined in: packages/lexical-yjs/src/index.ts:45


CONNECTED_COMMAND​

const CONNECTED_COMMAND: LexicalCommand<boolean>

Defined in: packages/lexical-yjs/src/index.ts:34


DIFF_VERSIONS_COMMAND__EXPERIMENTAL​

const DIFF_VERSIONS_COMMAND__EXPERIMENTAL: LexicalCommand<{ prevSnapshot?: Snapshot; snapshot?: Snapshot; }>

Defined in: packages/lexical-yjs/src/index.ts:39


TOGGLE_CONNECT_COMMAND​

const TOGGLE_CONNECT_COMMAND: LexicalCommand<boolean>

Defined in: packages/lexical-yjs/src/index.ts:36

Functions​

$getAnchorAndFocusForUserState()​

$getAnchorAndFocusForUserState(binding, userState): object

Defined in: packages/lexical-yjs/src/SyncCursors.ts:657

Parameters​

binding​

AnyBinding

userState​

UserState

Returns​

object

anchorKey​

anchorKey: string | null

anchorOffset​

anchorOffset: number

focusKey​

focusKey: string | null

focusOffset​

focusOffset: number


$getYChangeState()​

$getYChangeState<UserT>(node): YChange<UserT> | null

Defined in: packages/lexical-yjs/src/RenderSnapshot.ts:39

Type Parameters​

UserT​

UserT = unknown

Parameters​

node​

LexicalNode

Returns​

YChange<UserT> | null


createBinding()​

createBinding(editor, provider, id, doc, docMap, excludedProperties?): Binding

Defined in: packages/lexical-yjs/src/Bindings.ts:90

Parameters​

editor​

LexicalEditor

provider​

Provider

id​

string

doc​

Doc | null | undefined

docMap​

Map<string, Doc>

excludedProperties?​

ExcludedProperties

Returns​

Binding


createBindingV2__EXPERIMENTAL()​

createBindingV2__EXPERIMENTAL(editor, id, doc, docMap, options?): BindingV2

Defined in: packages/lexical-yjs/src/Bindings.ts:116

Parameters​

editor​

LexicalEditor

id​

string

doc​

Doc | null | undefined

docMap​

Map<string, Doc>

options?​
excludedProperties?​

ExcludedProperties

rootName?​

string

Returns​

BindingV2


createUndoManager()​

createUndoManager(binding, root): UndoManager

Defined in: packages/lexical-yjs/src/index.ts:89

Parameters​

binding​

BaseBinding

root​

YXmlText | YXmlElement<{[key: string]: string; }>

Returns​

UndoManager


getAnchorAndFocusCollabNodesForUserState()​

getAnchorAndFocusCollabNodesForUserState(binding, userState): object

Defined in: packages/lexical-yjs/src/SyncCursors.ts:623

Parameters​

binding​

Binding

userState​

UserState

Returns​

object

anchorCollabNode​

anchorCollabNode: AnyCollabNode | null

anchorOffset​

anchorOffset: number

focusCollabNode​

focusCollabNode: AnyCollabNode | null

focusOffset​

focusOffset: number

Deprecated​

Use $getAnchorAndFocusForUserState instead.


initLocalState()​

initLocalState(provider, name, color, focusing, awarenessData): void

Defined in: packages/lexical-yjs/src/index.ts:98

Parameters​

provider​

Provider

name​

string

color​

string

focusing​

boolean

awarenessData​

object

Returns​

void


removeCursorHighlightRule()​

removeCursorHighlightRule(binding, highlightName): void

Defined in: packages/lexical-yjs/src/SyncCursors.ts:151

Parameters​

binding​

BaseBinding

highlightName​

string

Returns​

void


renderSnapshot__EXPERIMENTAL()​

renderSnapshot__EXPERIMENTAL(binding, snapshot?, prevSnapshot?): void

Defined in: packages/lexical-yjs/src/RenderSnapshot.ts:55

Replaces the editor content with a view that compares the state between two given snapshots. Any added or removed nodes between the two snapshots will have YChange attached to them.

Parameters​

binding​

BindingV2

Yjs binding

snapshot?​

Snapshot = ...

Ending snapshot state (default: current state of the Yjs document)

prevSnapshot?​

Snapshot = emptySnapshot

Starting snapshot state (default: empty snapshot)

Returns​

void


setLocalStateFocus()​

setLocalStateFocus(provider, name, color, focusing, awarenessData): void

Defined in: packages/lexical-yjs/src/index.ts:115

Parameters​

provider​

Provider

name​

string

color​

string

focusing​

boolean

awarenessData​

object

Returns​

void


syncCursorPositions()​

syncCursorPositions(binding, provider, options?): void

Defined in: packages/lexical-yjs/src/SyncCursors.ts:884

Parameters​

binding​

AnyBinding

provider​

Provider

options?​

SyncCursorPositionsOptions

Returns​

void


syncLexicalUpdateToYjs()​

syncLexicalUpdateToYjs(binding, provider, prevEditorState, currEditorState, dirtyElements, dirtyLeaves, normalizedNodes, tags): void

Defined in: packages/lexical-yjs/src/SyncEditorStates.ts:357

Parameters​

binding​

Binding

provider​

Provider

prevEditorState​

EditorState

currEditorState​

EditorState

dirtyElements​

Map<string, boolean>

dirtyLeaves​

Set<string>

normalizedNodes​

Set<string>

tags​

Set<string>

Returns​

void


syncLexicalUpdateToYjsV2__EXPERIMENTAL()​

syncLexicalUpdateToYjsV2__EXPERIMENTAL(binding, provider, prevEditorState, currEditorState, dirtyElements, dirtyLeaves, normalizedNodes, tags): void

Defined in: packages/lexical-yjs/src/SyncEditorStates.ts:566

Parameters​

binding​

BindingV2

provider​

Provider

prevEditorState​

EditorState

currEditorState​

EditorState

dirtyElements​

Map<string, boolean>

dirtyLeaves​

Set<string>

normalizedNodes​

Set<string>

tags​

Set<string>

Returns​

void


syncYjsChangesToLexical()​

syncYjsChangesToLexical(binding, provider, events, isFromUndoManger, syncCursorPositionsFn?): void

Defined in: packages/lexical-yjs/src/SyncEditorStates.ts:193

Parameters​

binding​

Binding

provider​

Provider

events​

YEvent<YText>[]

isFromUndoManger​

boolean

syncCursorPositionsFn?​

SyncCursorPositionsFn = syncCursorPositions

Returns​

void


syncYjsChangesToLexicalV2__EXPERIMENTAL()​

syncYjsChangesToLexicalV2__EXPERIMENTAL(binding, provider, events, transaction, isFromUndoManger): void

Defined in: packages/lexical-yjs/src/SyncEditorStates.ts:479

Parameters​

binding​

BindingV2

provider​

Provider

events​

YEvent<YXmlText | YXmlElement<{[key: string]: string; }>>[]

transaction​

Transaction

isFromUndoManger​

boolean

Returns​

void


syncYjsStateToLexicalV2__EXPERIMENTAL()​

syncYjsStateToLexicalV2__EXPERIMENTAL(binding, provider): void

Defined in: packages/lexical-yjs/src/SyncEditorStates.ts:538

Parameters​

binding​

BindingV2

provider​

Provider

Returns​

void