コメント
ユーザーは、コメントを追加し、文書内で返信することができます。そのため、チームメンバーはコンテンツを所定の場所で議論することができます。
プラグインモード
インストール
pnpm add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uinpm install @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uiyarn add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-uibun add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs/docs-thread-comment @univerjs/docs-thread-comment-ui使い方
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/ja-JP'import ThreadCommentUIJaJP from '@univerjs/thread-comment-ui/locale/ja-JP'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.JA_JP, locales: { [LocaleType.JA_JP]: mergeLocales( ThreadCommentUIJaJP, DocsCommentLocale, ), },})univer.registerPlugin(UniverThreadCommentPlugin)univer.registerPlugin(UniverThreadCommentUIPlugin)univer.registerPlugin(UniverDocsThreadCommentPlugin)univer.registerPlugin(UniverDocsThreadCommentUIPlugin)共同編集機能と併用する場合
アプリケーションが コラボレーション を使用している場合は、データソースプラグインも登録します。
pnpm add @univerjs-pro/thread-comment-datasourcenpm install @univerjs-pro/thread-comment-datasourceyarn add @univerjs-pro/thread-comment-datasourcebun add @univerjs-pro/thread-comment-datasourceimport { UniverThreadCommentDataSourcePlugin } from '@univerjs-pro/thread-comment-datasource'univer.registerPlugin(UniverThreadCommentDataSourcePlugin)モバイル対応
モバイルエディタを最初に構成します。このページのプラグインモード設定では、同じパッケージからモバイルエクスポートに以下にリストされているデスクトップ登録を置き換え、代替ドキュメントを開く前にを作ります。モデルプラグイン、スタイル、ロケール、ファサードのインポートを保持し、両方のバリアントを登録しないでください。
| パッケージ | デスクトップの登録 | モバイルの登録 |
|---|---|---|
@univerjs/docs-thread-comment-ui | UniverDocsThreadCommentUIPlugin | UniverDocsThreadCommentMobileUIPlugin |
@univerjs/thread-comment-ui | UniverThreadCommentUIPlugin | UniverThreadCommentMobileUIPlugin |
プリセットモード
インストール
pnpm add @univerjs/preset-docs-thread-commentnpm install @univerjs/preset-docs-thread-commentyarn add @univerjs/preset-docs-thread-commentbun add @univerjs/preset-docs-thread-comment使い方
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'import UniverPresetDocsCoreJaJP from '@univerjs/preset-docs-core/locales/ja-JP'import { UniverDocsThreadCommentPreset } from '@univerjs/preset-docs-thread-comment'import UniverPresetDocsThreadCommentJaJP from '@univerjs/preset-docs-thread-comment/locales/ja-JP'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.JA_JP, locales: { [LocaleType.JA_JP]: mergeLocales( UniverPresetDocsCoreJaJP, UniverPresetDocsThreadCommentJaJP, ), }, presets: [ UniverDocsCorePreset(), UniverDocsThreadCommentPreset(), ],})コメント Facade
これらのメソッドを呼び出す前に、共有コメントファサードと製品ファサードをインポートします。製品ヘルパーは安定したアンカーを作成し、共有された API は、応答、更新、解像度、削除を処理します。 getComments() は、ローカルの状態を読み取ります。 listCommentsAsync()は、構成されたデータソースを介して既に知られているスレッドを同期させます。それは、サーバー上のすべてのスレッドを発見しません。
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())}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を呼び出します。 そのため、アプリケーションはこれらのルートを明示する必要があります。 コメントの読み込みと書き込みには、別のサーバー権限が必要です。 ドキュメント編集権限はそれらをカバーしません。
画像とチャートへのコメント
ホストの描画またはチャートプラグインを最初に設定し、ユニットを開く前に、以下のマッチング統合とファサードのエントリを追加します。 プラグインモードとプリセットモードの両方が、これらの統合を明示的に登録する必要があります。 スタイルやロケールを追加しません。
pnpm add @univerjs-pro/docs-drawing-thread-comment @univerjs-pro/docs-chart-thread-commentnpm install @univerjs-pro/docs-drawing-thread-comment @univerjs-pro/docs-chart-thread-commentyarn add @univerjs-pro/docs-drawing-thread-comment @univerjs-pro/docs-chart-thread-commentbun add @univerjs-pro/docs-drawing-thread-comment @univerjs-pro/docs-chart-thread-commentimport { 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() は、それらを返す前に知っているスレッドを同期させます。
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
このガイドはいかがですか?