# Commentaires

- Human documentation: [https://docs.univer.ai/fr-FR/guides/boards/features/comments](https://docs.univer.ai/fr-FR/guides/boards/features/comments)

- Agent Markdown: [https://docs.univer.ai/fr-FR/guides/boards/features/comments.md](https://docs.univer.ai/fr-FR/guides/boards/features/comments.md)

- Requested language: `fr-FR`

- Content language: `fr-FR`

- Documentation version: `1.2.0`

- Source: [boards/features/comments.fr-FR.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/boards/features/comments.fr-FR.mdx)

---

#### Package metadata

```json
{
  "mobile": true,
  "preset": [],
  "plugins": [
    {
      "client": "@univerjs/thread-comment",
      "facade": "@univerjs/thread-comment/facade"
    },
    {
      "client": "@univerjs/thread-comment-ui",
      "locale": "@univerjs/thread-comment-ui/locale/fr-FR",
      "style": "@univerjs/thread-comment-ui/lib/index.css"
    },
    {
      "client": "@univerjs-pro/boards-thread-comment",
      "facade": "@univerjs-pro/boards-thread-comment/facade"
    },
    {
      "client": "@univerjs-pro/boards-thread-comment-ui",
      "locale": "@univerjs-pro/boards-thread-comment-ui/locale/fr-FR",
      "style": "@univerjs-pro/boards-thread-comment-ui/lib/index.css"
    }
  ],
  "license": true,
  "server": "optional"
}
```

Enregistrez les plugins après l’éditeur du produit et la licence. Chargez les styles et les langues des interfaces commune et propre au produit. Le plugin du produit gère les ressources de commentaires : enregistrez-le avant de restaurer un snapshot.

#### npm

```bash
npm install @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-ui
```

#### pnpm

```bash
pnpm add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-ui
```

#### yarn

```bash
yarn add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-ui
```

#### bun

```bash
bun add @univerjs/thread-comment @univerjs/thread-comment-ui @univerjs-pro/boards-thread-comment @univerjs-pro/boards-thread-comment-ui
```

```ts
import { 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/fr-FR'
import { LocaleType, mergeLocales } from '@univerjs/core'
import SharedLocale from '@univerjs/thread-comment-ui/locale/fr-FR'

import '@univerjs/thread-comment-ui/lib/index.css'
import '@univerjs-pro/boards-thread-comment-ui/lib/index.css'

univerAPI.loadLocales(LocaleType.FR_FR, mergeLocales(SharedLocale, ProductLocale))
univer.registerPlugin(UniverBoardsThreadCommentPlugin)
univer.registerPlugin(UniverBoardsThreadCommentUIPlugin)
```

## Prise en charge mobile

Configurez d’abord l’[éditeur mobile](https://docs.univer.ai/fr-FR/guides/boards/getting-started/installation.md#mobile-support). Dans l’initialisation en mode plugin de cette page, remplacez les inscriptions de bureau ci-dessous par les exports mobiles des mêmes paquets **avant d’ouvrir un document**. Conservez modèles, styles, traductions et imports Facade ; n’enregistrez pas les deux variantes.

| Paquet                                   | Inscription de bureau               | Inscription mobile                        |
| ---------------------------------------- | ----------------------------------- | ----------------------------------------- |
| `@univerjs-pro/boards-thread-comment-ui` | `UniverBoardsThreadCommentUIPlugin` | `UniverBoardsThreadCommentMobileUIPlugin` |

## Facade des commentaires

Importez la Facade commune et celle du produit. Les méthodes du produit créent les ancres stables ; l’API commune gère réponses, mises à jour, résolution et suppression. `getComments()` lit l’état local. `listCommentsAsync()` synchronise les fils déjà connus via la source configurée ; cette méthode ne découvre pas tous les fils du serveur.

```ts
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())
}
```

```ts
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.',
  })
}
```

## Discussions partagées

Intégrez Comment Service et Endpoint avec le [Server SDK](https://docs.univer.ai/fr-FR/server/collaboration/extensions.md), puis enregistrez `UniverThreadCommentDataSourcePlugin` de `@univerjs-pro/thread-comment-datasource` après la collaboration et la licence. La source fournie utilise `/universer-api/comment/unit/{unitId}/...` et `/universer-api/user/list` : exposez ces routes dans l’application. Le serveur doit autoriser la lecture et l’écriture des commentaires indépendamment de la modification du document.
