Comments

GitHubEdit on GitHub
Preset Info
@univerjs/preset-docs-thread-comment
Server Required
Optional

Comments allow users to add comments and replies within documents, facilitating communication and collaboration among team members.

Preset Mode

Installation

npm install @univerjs/preset-docs-thread-comment

Usage

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, merge } 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]: merge(
      {},
      UniverPresetDocsCoreEnUS,
      UniverPresetDocsThreadCommentEnUS, 
    ),
  },
  presets: [
    UniverDocsCorePreset(),
    UniverDocsThreadCommentPreset(), 
  ],
})

Using with Collaboration Feature

If you are using the collaboration feature with UniverDocsCollaborationPreset, make sure to pass the collaboration: true option in UniverDocsThreadCommentPreset:

UniverDocsThreadCommentPreset({
  collaboration: true, 
})

Plugin Mode

Installation

npm install @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment-ui

Usage

import { LocaleType, merge, Univer } from '@univerjs/core'
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/thread-comment-ui/lib/index.css'

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: merge(
      {},
      ThreadCommentUIEnUS, 
    ),
  },
})

univer.registerPlugin(UniverThreadCommentPlugin) 
univer.registerPlugin(UniverThreadCommentUIPlugin) 
univer.registerPlugin(UniverDocsThreadCommentUIPlugin) 

Using with Collaboration Feature

If you are using the collaboration feature, configure it as follows:

npm install @univerjs-pro/thread-comment-datasource
import { UniverThreadCommentDataSourcePlugin } from '@univerjs-pro/thread-comment-datasource'

univer.registerPlugin(UniverThreadCommentDataSourcePlugin)