Collaboration

Collaborative editing requires a backend behind the browser editor. Begin with Collaboration integration: run the example there, then connect the application's identity, permissions, and storage. Collaboration Quick Start covers the browser and server configuration.

Create the document through an authenticated API in the application, then load the Unit identifier that the API returns with the method below. Reuse that identifier whenever the same document is opened again.

Load the document

Set the current user before loading a document. The current user identifies the collaborator and owns the local offline cache. After that, load the document explicitly through the Facade:

TypeScript
import { UserManagerService } from '@univerjs/core'import '@univerjs-pro/collaboration-client/facade'univer.__getInjector().get(UserManagerService).setCurrentUser({ userID, name, avatar })const collaboration = univerAPI.getCollaboration()const unit = await collaboration.loadSheetAsync('your-unit-id')

For saving indicators, or to protect edits that the server has not acknowledged before a reload, see synchronization status, retries, and conflict recovery.

Removal of built-in URL loading for collaborative documents

Note

As of version 1.2.0, Univer has removed the built-in URL loading for collaborative documents. It no longer automatically reads the unit, type, and subunit URL parameters to load a document and activate a worksheet.

If an application depends on that behavior, a custom plugin can restore it.

Integrate the custom plugin

Copy the four files below into the project and keep this directory structure:

text
custom-url-load/├── plugin.ts├── controllers/│   └── data-loader.controller.ts└── services/    ├── url.service.ts    └── web-url.service.ts

Initialize the editor and the collaboration plugins first. Set the current user, then register CustomUrlLoadPlugin. This integration works in both plugin mode and preset mode:

TypeScript
import { UserManagerService } from '@univerjs/core'import { CustomUrlLoadPlugin } from './custom-url-load/plugin'univer.__getInjector().get(UserManagerService).setCurrentUser({ userID, name, avatar })univer.registerPlugin(CustomUrlLoadPlugin)

After that, the plugin loads the document itself, so the application does not call loadSheetAsync() for the same document. If the application already loads documents through the Facade, keep the approach from the previous section and handle URLs as the application requires.

Complete plugin code

TypeScript
import { UniverCollaborationClientPlugin } from '@univerjs-pro/collaboration-client'import { DependentOn, Inject, Injector, Plugin } from '@univerjs/core'import { CollaborationDataLoaderController } from './controllers/data-loader.controller'import { IURLService } from './services/url.service'import { WebURLService } from './services/web-url.service'@DependentOn(UniverCollaborationClientPlugin)export class CustomUrlLoadPlugin extends Plugin {  static override pluginName = 'CUSTOM_URL_LOAD_PLUGIN'  constructor(    _config: undefined,    @Inject(Injector) protected override readonly _injector: Injector  ) {    super()  }  override onStarting(): void {    this._injector.add([IURLService, { useClass: WebURLService }])    this._injector.add([CollaborationDataLoaderController])    this.disposeWithMe(this._injector.get(IURLService))    this.disposeWithMe(this._injector.get(CollaborationDataLoaderController))  }}

Node.js / AI SDK · OT

How is this guide?

© 2026 DreamNum Co., Ltd.