# Mise en surbrillance en croix

- Human documentation: [https://docs.univer.ai/fr-FR/guides/sheets/features/crosshair-highlighting](https://docs.univer.ai/fr-FR/guides/sheets/features/crosshair-highlighting)

- Agent Markdown: [https://docs.univer.ai/fr-FR/guides/sheets/features/crosshair-highlighting.md](https://docs.univer.ai/fr-FR/guides/sheets/features/crosshair-highlighting.md)

- Requested language: `fr-FR`

- Content language: `fr-FR`

- Documentation version: `1.2.0`

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

---

#### Package metadata

```json
{
  "mobile": true,
  "plugins": [
    {
      "client": "@univerjs/sheets-crosshair-highlight",
      "facade": "@univerjs/sheets-crosshair-highlight/facade",
      "locale": "@univerjs/sheets-crosshair-highlight/locale/fr-FR",
      "style": "@univerjs/sheets-crosshair-highlight/lib/index.css"
    }
  ],
  "server": false
}
```

La mise en surbrillance en croix met en évidence la ligne et la colonne de la cellule sélectionnée afin de faciliter son repérage.

> Interactive example: [Open the playground](/playground/sheets/crosshair-highlighting)

## Mode plugin

### Installation

#### npm

```bash
npm install @univerjs/sheets-crosshair-highlight
```

#### pnpm

```bash
pnpm add @univerjs/sheets-crosshair-highlight
```

#### yarn

```bash
yarn add @univerjs/sheets-crosshair-highlight
```

#### bun

```bash
bun add @univerjs/sheets-crosshair-highlight
```

### Utilisation

```typescript
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight'
import SheetsCrosshairHighlightEnUS from '@univerjs/sheets-crosshair-highlight/locale/en-US'
import '@univerjs/sheets-crosshair-highlight/lib/index.css'
import '@univerjs/sheets-crosshair-highlight/facade'

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: mergeLocales(
      SheetsCrosshairHighlightEnUS, // [!code ++]
    ),
  },
})

univer.registerPlugin(UniverSheetsCrosshairHighlightPlugin) // [!code ++]
```

## Prise en charge mobile

Configurez d’abord l’[éditeur mobile](https://docs.univer.ai/fr-FR/guides/sheets/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/sheets-crosshair-highlight` | `UniverSheetsCrosshairHighlightPlugin` | `UniverSheetsCrosshairHighlightMobileUIPlugin` |

## Mode preset

La fonctionnalité de mise en surbrillance en croix ne propose pas de mode preset, mais son plugin peut être utilisé avec un preset.

#### npm

```bash
npm install @univerjs/sheets-crosshair-highlight
```

#### pnpm

```bash
pnpm add @univerjs/sheets-crosshair-highlight
```

#### yarn

```bash
yarn add @univerjs/sheets-crosshair-highlight
```

#### bun

```bash
bun add @univerjs/sheets-crosshair-highlight
```

### Utilisation

```typescript
import UniverPresetSheetsCoreEnUS from '@univerjs/preset-sheets-core/locales/en-US'
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight' // [!code ++]
import '@univerjs/sheets-crosshair-highlight/facade' // [!code ++]
import '@univerjs/sheets-crosshair-highlight/lib/index.css' // [!code ++]

const { univerAPI } = createUniver({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: mergeLocales(
      UniverPresetSheetsCoreEnUS,
      SheetsCrosshairHighlightEnUS, // [!code ++]
    ),
  },
  presets: [
    UniverSheetsCorePreset(),
  ],
  plugins: [
    UniverSheetsCrosshairHighlightPlugin, // [!code ++]
  ],
})
```

## Facade API

Les définitions de types complètes de la Facade API sont disponibles dans la [FacadeAPI](https://docs.univer.ai/fr-FR/reference/facade.md).

### Importation

> [!INFO: Remarque sur le mode plugin]
> Seul le mode plugin nécessite d’importer manuellement le package Facade. Le mode preset inclut déjà le package Facade correspondant ; aucun import supplémentaire n’est donc nécessaire.

```typescript
import '@univerjs/sheets-crosshair-highlight/facade'
```

### Activer ou désactiver la mise en surbrillance en croix

```typescript
univerAPI.setCrosshairHighlightEnabled(true)

univerAPI.setCrosshairHighlightEnabled(false)
```

### Obtenir l’état d’activation de la mise en surbrillance en croix

```typescript
univerAPI.getCrosshairHighlightEnabled()
```

### Écouteurs d’événements

Les définitions de types complètes des événements sont disponibles dans la page [Events](https://docs.univer.ai/fr-FR/reference/facade/events.md).

L’événement `CrosshairHighlightEnabledChanged` est déclenché lorsque l’état d’activation de la mise en surbrillance en croix change.

```typescript
const disposable = univerAPI.addEvent(univerAPI.Event.CrosshairHighlightEnabledChanged, (params) => {
  const { enabled, workbook, worksheet } = params
})

// Remove the event listener using `disposable.dispose()`
```

L’événement `CrosshairHighlightColorChanged` est déclenché lorsque la couleur de la mise en surbrillance en croix change.

```typescript
const disposable = univerAPI.addEvent(univerAPI.Event.CrosshairHighlightColorChanged, (params) => {
  const { color, workbook, worksheet } = params
})

// Remove the event listener using `disposable.dispose()`
```
