댓글
제품 편집기 후 코멘트 플러그인을 등록하고 라이센스 구성이 완료되고 로컬 리소스와 함께 공유 및 제품 UI 스타일을로드합니다. 제품 플러그인은 댓글 리소스를 소유하므로 스냅 샷이 복원되기 전에 등록해야합니다.
pnpm add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-uinpm install @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-uiyarn add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-uibun add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-uiimport { UniverBoardsThreadCommentPlugin } from '@univerjs-pro/boards-thread-comment'import { UniverBoardsThreadCommentUIPlugin } from '@univerjs-pro/boards-thread-comment-ui'import ProductLocale from '@univerjs-pro/boards-thread-comment-ui/locale/ko-KR'import { LocaleType, mergeLocales } from '@univerjs/core'import SharedLocale from '@univerjs/thread-comment-ui/locale/ko-KR'import '@univerjs/thread-comment-ui/lib/index.css'import '@univerjs-pro/boards-thread-comment-ui/lib/index.css'univerAPI.loadLocales(LocaleType.KO_KR, mergeLocales(SharedLocale, ProductLocale))univer.registerPlugin(UniverBoardsThreadCommentPlugin)univer.registerPlugin(UniverBoardsThreadCommentUIPlugin)모바일 지원
모바일 편집기를 먼저 구성하십시오. 이 페이지에서 설명 된 플러그인 모드 설정에서 동일한 패키지에서 모바일 내보내기로 아래 데스크탑 등록을 대체하고 문서 열기을 수행하십시오. 모델 플러그인, 스타일, 로컬 및 Facade 가져 오기를 유지하고 두 변형을 등록하지 마십시오.
| 패키지 | 데스크톱 등록 | 모바일 등록 |
|---|---|---|
@univerjs-pro/boards-thread-comment-ui | UniverBoardsThreadCommentUIPlugin | UniverBoardsThreadCommentMobileUIPlugin |
댓글 Facade
공유된 코멘트 Facade 및 제품 Facade를 가져 오는 방법은 호출됩니다. 제품 돕는자는 안정적인 앵커를 만들고 공유 API는 응답, 업데이트, 해상도 및 삭제를 처리합니다. getComments()는 로컬 상태를 읽습니다. listCommentsAsync()은 스레드를 이미 구성 된 데이터 소스를 통해 알고 있습니다. 서버에서 모든 스레드를 발견하지 않습니다.
import '@univerjs/thread-comment/facade'import '@univerjs-pro/boards-thread-comment/facade'const board = univerAPI.getActiveBoard()if (board) { await board.createPositionCommentAsync({ x: 320, y: 180 }, 'Review this area.') console.log(await board.listCommentsAsync())}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로 전화하여 응용 프로그램은이 루트를 노출해야합니다. 코멘트를 읽고 쓰기는 자신의 서버 권한이 요구됩니다. 문서 편집 권한은 그에 포함되지 않습니다.
이 가이드는 어떠셨나요?