CollabReferenceCollab clientInterfaces

CollabClientConfig

Interface: CollabClientConfig

Defined in: packages/collab-client/src/index.ts:22

Properties

listener

listener: CommitsListener;

Defined in: packages/collab-client/src/index.ts:37

A listener for remote commits.

Currently the only built-in option is the LongPollListener.


receiveCommits

receiveCommits: (commits: Commit[]) => void;

Defined in: packages/collab-client/src/index.ts:58

Receives an array of commits and merges them into your local editor state.

Parameters

commits

Commit[]

Returns

void

Example

import receiveCommitTransaction from "@stepwisehq/prosemirror-collab-commit/collab-commit";

receiveCommits: (commits) => {
  view.dispatch(
    view.state.apply(
      commits.reduce((acc, commit) => acc.apply(receiveCommitTransaction(acc, commit)), prev)
    )
  )
},

sendCommit

sendCommit: (commit: Commit) => Promise<void>;

Defined in: packages/collab-client/src/index.ts:31

Sends local commits to a remote server to be merged into the remote document state. The endpoint this function hits is defined by you, and should call the CollabAuthority's receiveCommit function.

Parameters

commit

Commit

the latest prosemirror commit made by the local user

Returns

Promise<void>

On this page