@univerjs-pro/collaboration-client

GitHubEdit on GitHub

Client-side collaboration plugin for Univer Pro.

import { UniverCollaborationClientPlugin } from '@univerjs-pro/collaboration-client'

univer.registerPlugin(UniverCollaborationClientPlugin, IUniverCollaborationClientConfig)

IUniverCollaborationClientConfig

import type { Ctor, DependencyOverride } from '@univerjs/core'
import type { ICollaborationSocketService } from '../services/socket/collaboration-socket.service'

export interface IUniverCollaborationClientConfig {
  /**
   * Which socket should the plugin use to build connections to the collaborative engine.
   * For normal cases, you should use `BrowserCollaborationSocketService` from the `collaboration-client-ui` plugin.
   */
  socketService: Ctor<ICollaborationSocketService>

  /**
   * If the plugin should enable collaborative editing. Which means the client will exchange edits with
   * the collaboration server. It this is set to false, the client will simply load data from the server.
   *
   * @default true
   */
  enableCollaboration?: boolean

  /**
   * If offline editing is enabled.
   * @default false
   */
  enableOfflineEditing?: boolean
  enableSingleActiveInstanceLock?: boolean
  enableAuthServer?: boolean
  /**
   * Override internal modules with custom implementations.
   */
  override?: DependencyOverride

  sendChangesetTimeout?: number
  snapshotServerUrl?: string
  collabSubmitChangesetUrl?: string
  collabWebSocketUrl?: string
  /**
   * The URL of the endpoint for getting the websocket session ticket.
   */
  wsSessionTicketUrl?: string
  loginUrlKey?: string
  retryConnectingInterval?: number
  authzUrl?: string

  /**
   * The URL of the endpoint for downloading files.
   * @default 'location.origin'
   */
  downloadEndpointUrl?: string
  uploadFileServerUrl?: string
  signUrlServerUrl?: string

  /**
   * The URL of the endpoint for starting formula limit.
   */
  startFormulaLimitUrl?: string

  /**
   * The URL of the endpoint for getting formula limit status.
   */
  getFormulaLimitStatusUrl?: string

  /**
   * The URL of the endpoint for releasing formula limit.
   */
  releaseFormulaLimitUrl?: string

  /**
   * The socket connection custom headers.
   */
  customHeaders?: Record<string, string>
}