---
title: "tinymce.Annotator"
description: "This is the annotator api."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.annotator/"
md_url: "https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.annotator/index.md"
version: "6"
last_updated: "2022-06-27T01:45:26Z"
tokens: 609
---
Important This page documents TinyMCE 6. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../../latest/apis/tinymce.annotator/).
# tinymce.Annotator

This is the annotator api.

## Summary

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [annotate()](#annotate) | Applies the annotation at the current selection using data | `Annotator` |
| [annotationChanged()](#annotationChanged) | Executes the specified callback when the current selection matches the annotation or not. | `Annotator` |
| [getAll()](#getAll) | Retrieve all the annotations for a given name | `Annotator` |
| [register()](#register) | Registers a specific annotator by name | `Annotator` |
| [remove()](#remove) | Removes any annotations from the current selection that match
the name | `Annotator` |
| [removeAll()](#removeAll) | Removes all annotations that match the specified name from the entire document. | `Annotator` |

## Methods

### annotate()

```javascript
annotate(name: String, data: Object)
```
Applies the annotation at the current selection using data

#### Parameters

- `name (String)` - the name of the annotation to apply
- `data (Object)` - information to pass through to this particular
annotation

### annotationChanged()

```javascript
annotationChanged(name: String, callback: Function)
```
Executes the specified callback when the current selection matches the annotation or not.

#### Parameters

- `name (String)` - Name of annotation to listen for
- `callback (Function)` - Callback with (state, name, and data) fired when the annotation
at the cursor changes. If state if false, data will not be provided.

### getAll()

```javascript
getAll(name: String): Object
```
Retrieve all the annotations for a given name

#### Parameters

- `name (String)` - the name of the annotations to retrieve

#### Return value

- `Object` - an index of annotations from uid ⇒ DOM nodes

### register()

```javascript
register(name: String, settings: Object)
```
Registers a specific annotator by name

#### Parameters

- `name (String)` - the name of the annotation
- `settings (Object)` - settings for the annotation (e.g. decorate)

### remove()

```javascript
remove(name: String)
```
Removes any annotations from the current selection that match
the name

#### Parameters

- `name (String)` - the name of the annotation to remove

### removeAll()

```javascript
removeAll(name: String)
```
Removes all annotations that match the specified name from the entire document.

#### Parameters

- `name (String)` - the name of the annotation to remove
