---
title: "tinymce.dom.BookmarkManager"
description: "This class handles selection bookmarks."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/apis/tinymce.dom.bookmarkmanager/"
md_url: "https://www.tiny.cloud/docs/tinymce/5/apis/tinymce.dom.bookmarkmanager/index.md"
version: "5"
last_updated: "2024-03-26T08:09:19Z"
tokens: 667
---
Important This page documents TinyMCE 5. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../../latest/apis/tinymce.dom.bookmarkmanager/).
# tinymce.dom.BookmarkManager

This class handles selection bookmarks.

## Summary

### Constructors

| Name | Summary | Defined by |
| --- | --- | --- |
| [BookmarkManager()](#BookmarkManager) | Constructs a new BookmarkManager instance for a specific selection instance. | `BookmarkManager` |

### Methods

| Name | Summary | Defined by |
| --- | --- | --- |
| [getBookmark()](#getBookmark) | Returns a bookmark location for the current selection. This bookmark object can then be used to restore the selection after some content modification to the document. | `BookmarkManager` |
| [isBookmarkNode()](#isBookmarkNode) | Returns true/false if the specified node is a bookmark node or not. | `BookmarkManager` |
| [moveToBookmark()](#moveToBookmark) | Restores the selection to the specified bookmark. | `BookmarkManager` |

## Constructors

### BookmarkManager

```javascript
public constructor function BookmarkManager(selection: tinymce.dom.Selection)
```
Constructs a new BookmarkManager instance for a specific selection instance.

#### Parameters

- `selection (Selection)` - Selection instance to handle bookmarks for.

## Methods

### getBookmark()

```javascript
getBookmark(type: Number, normalized: Boolean): Object
```
Returns a bookmark location for the current selection. This bookmark object
can then be used to restore the selection after some content modification to the document.

#### Examples

```javascript
// Stores a bookmark of the current selection
var bm = tinymce.activeEditor.selection.getBookmark();

tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');

// Restore the selection bookmark
tinymce.activeEditor.selection.moveToBookmark(bm);
```

#### Parameters

- `type (Number)` - Optional state if the bookmark should be simple or not. Default is complex.
- `normalized (Boolean)` - Optional state that enables you to get a position that it would be after normalization.

#### Return value

- `Object` - Bookmark object, use moveToBookmark with this object to restore the selection.

### isBookmarkNode()

```javascript
isBookmarkNode(node: DOMNode): Boolean
```
Returns true/false if the specified node is a bookmark node or not.

#### Parameters

- `node (DOMNode)` - DOM Node to check if it’s a bookmark node or not.

#### Return value

- `Boolean` - true/false if the node is a bookmark node or not.

### moveToBookmark()

```javascript
moveToBookmark(bookmark: Object)
```
Restores the selection to the specified bookmark.

#### Examples

```javascript
// Stores a bookmark of the current selection
var bm = tinymce.activeEditor.selection.getBookmark();

tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');

// Restore the selection bookmark
tinymce.activeEditor.selection.moveToBookmark(bm);
```

#### Parameters

- `bookmark (Object)` - Bookmark to restore selection from.
