Comments
Server OptionalOptional server for enhanced features
Comments allow users to add comments and replies within documents, facilitating communication and collaboration among team members.
Preset Mode
Installation
Shell
pnpm add @univerjs/preset-docs-thread-commentShell
npm install @univerjs/preset-docs-thread-commentShell
yarn add @univerjs/preset-docs-thread-commentShell
bun add @univerjs/preset-docs-thread-commentUsage
TypeScript
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'import UniverPresetDocsCoreEnUS from '@univerjs/preset-docs-core/locales/en-US'import { UniverDocsThreadCommentPreset } from '@univerjs/preset-docs-thread-comment'import UniverPresetDocsThreadCommentEnUS from '@univerjs/preset-docs-thread-comment/locales/en-US'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-docs-core/lib/index.css'import '@univerjs/preset-docs-thread-comment/lib/index.css'const { univerAPI } = createUniver({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales( UniverPresetDocsCoreEnUS, UniverPresetDocsThreadCommentEnUS, ), }, presets: [ UniverDocsCorePreset(), UniverDocsThreadCommentPreset(), ],})Plugin Mode
Installation
Shell
pnpm add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uiShell
npm install @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uiShell
yarn add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uiShell
bun add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uiUsage
TypeScript
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import { UniverDocsThreadCommentPlugin } from '@univerjs/docs-thread-comment'import { UniverDocsThreadCommentUIPlugin } from '@univerjs/docs-thread-comment-ui'import { UniverThreadCommentPlugin } from '@univerjs/thread-comment'import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui'import ThreadCommentUIEnUS from '@univerjs/thread-comment-ui/locale/en-US'import '@univerjs/docs-thread-comment/facade'import '@univerjs/thread-comment-ui/lib/index.css'const univer = new Univer({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales( ThreadCommentUIEnUS, ), },})univer.registerPlugin(UniverThreadCommentPlugin) univer.registerPlugin(UniverThreadCommentUIPlugin) univer.registerPlugin(UniverDocsThreadCommentPlugin) univer.registerPlugin(UniverDocsThreadCommentUIPlugin) Using with Collaboration Feature
If you are using the collaboration feature, configure it as follows:
Shell
pnpm add @univerjs-pro/thread-comment-datasourceShell
npm install @univerjs-pro/thread-comment-datasourceShell
yarn add @univerjs-pro/thread-comment-datasourceShell
bun add @univerjs-pro/thread-comment-datasourceTypeScript
import { UniverThreadCommentDataSourcePlugin } from '@univerjs-pro/thread-comment-datasource'univer.registerPlugin(UniverThreadCommentDataSourcePlugin) How is this guide?