# DifferItemInsert

interface

A single diff item for inserted nodes.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1603)

<a id="properties">

## Properties

<a id="member-action">

### `action: DifferItemAction`

Further specifies what kind of action led to generating this change.

The action is set in relation to the document state before any change. It means that, for example, if an element was added and then renamed (during the same [batch](module_engine_model_batch-Batch.md)), the action will be set to `'insert'`, because when compared to the document state before changes, a new element was inserted, and the renaming does not matter from this point of view.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1617)

<a id="member-attributes">

### `attributes: Map<string, unknown>`

Map of attributes of the inserted element.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1627)

<a id="member-before">

### `before?: object`

Holds information about the element state before all changes happened.

For example, when `<paragraph textAlign="right">` was changed to `<codeBlock language="plaintext">`, `before.name` will be equal to `'paragraph'` and `before.attributes` map will have one entry: `'textAlign' -> 'right'`.

The property is available only if the insertion change was due to element rename or refresh (when `action` property is `'rename'` or `'refresh'`). As such, `before` property is never available for text node changes.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1648)

<a id="member-length">

### `length: number`

The length of an inserted text node. For elements, it is always 1 as each inserted element is counted as a one.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1637)

<a id="member-name">

### `name: string`

The name of the inserted elements or `'$text'` for a text node.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1622)

<a id="member-position">

### `position: ModelPosition`

The position where the node was inserted.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1632)

<a id="member-type">

### `type: 'insert'`

The type of diff item.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-engine/src/model/differ.ts#L1608)

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
