Skip to main content

extension-collaboration

package @remirror/extension-collaboration

class CollaborationExtension

The collaboration extension adds collaborative functionality to your editor.

Once a central server is created the collaboration extension is good.

Signature:

export declare class CollaborationExtension extends PlainExtension<CollaborationOptions> 

Extends: PlainExtension<CollaborationOptions>

(Some inherited members may not be shown because they are not represented in the documentation.)

property name

Signature:

get name(): "collaboration";

method cancelSendableSteps

Signature:

cancelSendableSteps(): CommandFunction;

Returns:

CommandFunction

method createExternalPlugins

Signature:

createExternalPlugins(): ProsemirrorPlugin[];

Returns:

ProsemirrorPlugin[]

method flushSendableSteps

Signature:

flushSendableSteps(): CommandFunction;

Returns:

CommandFunction

method onDestroy

Signature:

onDestroy(): void;

Returns:

void

method onStateUpdate

Signature:

onStateUpdate(props: StateUpdateLifecycleProps): void;

Parameters:

ParameterTypeDescription
propsStateUpdateLifecycleProps

Returns:

void

method sendCollaborationUpdate

Send a collaboration update.

Signature:

sendCollaborationUpdate(attributes: CollaborationAttributes): CommandFunction;

Parameters:

ParameterTypeDescription
attributesCollaborationAttributes

Returns:

CommandFunction

interface CollaborationOptions

Signature:

export interface CollaborationOptions 

property clientID

The unique ID of the client connecting to the server.

Signature:

clientID: Static<number | string>;

property debounceMs

The debounce time in milliseconds

Signature:

debounceMs?: Static<number>;

property onSendableReceived

Called when an an editor transaction occurs and there are changes ready to be sent to the server.

Signature:

onSendableReceived: Handler<(props: OnSendableReceivedProps) => void>;

Remarks:

The callback will receive the jsonSendable which can be sent to the server as it is. If you need more control then the sendable property can be used to shape the data the way you require.

Since this method is called for everyTransaction that updates the jsonSendable value it is automatically debounced for you.

property version

The document version.

Signature:

version?: Static<number>;

interface JSONSendable

Signature:

export interface JSONSendable extends Omit<Sendable, 'steps' | 'origins'> 

Extends: Omit<Sendable, 'steps' | 'origins'>

(Some inherited members may not be shown because they are not represented in the documentation.)

property steps

Signature:

steps: Shape[];

interface OnSendableReceivedProps

Signature:

export interface OnSendableReceivedProps 

property jsonSendable

A sendable which can be sent to a server

Signature:

jsonSendable: JSONSendable;

property sendable

The raw sendable generated by the prosemirror-collab library.

Signature:

sendable: Sendable;

interface Sendable

Signature:

export interface Sendable 

property clientID

Signature:

clientID: number | string;

property origins

Signature:

origins: readonly Transaction[];

property steps

Signature:

steps: readonly Step[];

property version

Signature:

version: number;

type CollaborationAttributes

Signature:

export type CollaborationAttributes = ProsemirrorAttributes<{
steps: StepWithClientId[];
version: number;
}>;

References: ProsemirrorAttributes