Interface

DiffItemInsert (engine/model)

@ckeditor/ckeditor5-engine/src/model/differ

interface

A single diff item for inserted nodes.

Filtering

Properties

  • 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), 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.

  • attributes : Map<string, unknown>

    Map of attributes of the inserted element.

  • before : object | undefined

    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.

  • length : number

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

  • name : string

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

  • position : Position

    The position where the node was inserted.

  • type : 'insert'

    The type of diff item.