댓글

사용자는 문서 내에서 의견을 추가하고 답장을 할 수 있으므로 팀 구성원은 해당 장소에서 콘텐츠를 토론 할 수 있습니다.

플러그인 모드

설치

Shell
pnpm add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-ui

사용법

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 DocsCommentLocale from '@univerjs/docs-thread-comment-ui/locale/en-US'import ThreadCommentUIEnUS from '@univerjs/thread-comment-ui/locale/en-US'import '@univerjs/docs-thread-comment/facade'import '@univerjs/docs-thread-comment-ui/lib/index.css'import '@univerjs/thread-comment-ui/lib/index.css'const univer = new Univer({  locale: LocaleType.EN_US,  locales: {    [LocaleType.EN_US]: mergeLocales(      ThreadCommentUIEnUS,      DocsCommentLocale,     ),  },})univer.registerPlugin(UniverThreadCommentPlugin)univer.registerPlugin(UniverThreadCommentUIPlugin)univer.registerPlugin(UniverDocsThreadCommentPlugin)univer.registerPlugin(UniverDocsThreadCommentUIPlugin)

공동 편집 기능과 함께 사용

응용 프로그램은 회사연혁를 사용한다면 데이터 소스 플러그인을 등록하십시오.

Shell
pnpm add @univerjs-pro/thread-comment-datasource
TypeScript
import { UniverThreadCommentDataSourcePlugin } from '@univerjs-pro/thread-comment-datasource'univer.registerPlugin(UniverThreadCommentDataSourcePlugin)

모바일 지원

모바일 편집기를 먼저 구성하십시오. 이 페이지의 플러그인 모드 설정에서 동일한 패키지에서 모바일 수출으로 나열된 데스크탑 등록을 대체하고 문서 열기 교체하십시오. 모델 플러그인, 스타일, 로컬 및 Facade 가져 오기를 유지하고 두 가지 변형을 등록하지 마십시오.

패키지데스크톱 등록모바일 등록
@univerjs/docs-thread-comment-uiUniverDocsThreadCommentUIPluginUniverDocsThreadCommentMobileUIPlugin
@univerjs/thread-comment-uiUniverThreadCommentUIPluginUniverThreadCommentMobileUIPlugin

프리셋 모드

설치

Shell
pnpm add @univerjs/preset-docs-thread-comment

사용법

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(),   ],})

댓글 Facade

이 방법을 호출하기 전에 공유 코멘트 Facade 및 제품 Facade를 가져옵니다. 제품 도우미는 안정적인 앵커를 만들고 공유 API는 응답, 업데이트, 해결 및 삭제를 처리합니다. getComments()는 로컬 상태를 읽습니다. listCommentsAsync()은 구성 된 데이터 소스를 통해 이미 알려진 스레드를 동기화합니다. 서버에서 모든 스레드를 발견하지 않습니다.

TypeScript
import '@univerjs/thread-comment/facade'import '@univerjs/docs-thread-comment/facade'const range = univerAPI.getActiveDocument()?.getTextRange(0, 1)if (range) {  await range.createCommentAsync('Please review this text.')  console.log(await range.listCommentsAsync())}
TypeScript
import '@univerjs/thread-comment/facade'const [thread] = univerAPI.getComments({ resolved: false })if (thread) {  await univerAPI.replyCommentAsync({    unitId: thread.unitId,    subUnitId: thread.subUnitId,    threadId: thread.threadId,    content: 'Reviewed.',  })}

공유 토론

공유 토론은 Server SDK를 통해 연결되는 주석 서비스 및 엔드포인트가 필요합니다. 협업 및 라이센스 설정 후 UniverThreadCommentDataSourcePlugin을 @univerjs-pro/thread-comment-datasource로 등록하십시오. 공급된 데이터 소스는 /universer-api/comment/unit/{unitId}/...와 /universer-api/user/list라고 부릅니다. 응용 프로그램은 해당 루트를 노출해야합니다. 코멘트를 읽고 별도의 서버 권한이 필요합니다. 문서 편집 권한은 그 커버하지 않습니다.

이미지 및 차트 댓글

호스트 도면 또는 차트 플러그인을 먼저 구성하고, 아래 일치하는 통합을 추가하고 단위를 열 전에 Facade 항목. 플러그인 모드 및 미리 설정 모드 모두 명시적으로 등록 할 이러한 통합이 필요합니다. 그들은 스타일이나 로컬을 추가하지 않습니다.

Shell
pnpm add @univerjs-pro/docs-drawing-thread-comment @univerjs-pro/docs-chart-thread-comment
TypeScript
import { UniverDocsDrawingThreadCommentPlugin } from '@univerjs-pro/docs-drawing-thread-comment'import { UniverDocsChartThreadCommentPlugin } from '@univerjs-pro/docs-chart-thread-comment'import '@univerjs-pro/docs-drawing-thread-comment/facade'import '@univerjs-pro/docs-chart-thread-comment/facade'univer.registerPlugin(UniverDocsDrawingThreadCommentPlugin)univer.registerPlugin(UniverDocsChartThreadCommentPlugin)

단위가 열리면 이미 존재하는 이미지와 차트에 주석이 추가 될 수 있습니다. getComments()는 스레드가 로컬로로드되고 listCommentsAsync()가 스레드를 동기화하여 반환하기 전에 알고 있습니다.

TypeScript
const host = univerAPI.getActiveDocument()const image = host?.getImages()[0]const chart = host?.getCharts()[0]await image?.createCommentAsync('Review this image.')await chart?.createCommentAsync('Verify the chart source.')

@univerjs-pro/docs-drawing-thread-comment · @univerjs-pro/docs-chart-thread-comment

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.