DiffItemRemove (engine/model)



A single diff item for removed nodes.



  • attributes : Map<string, unknown>

    Map of attributes that were set on the item while it was removed.

  • length : number

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

  • name : string

    The name of the removed element or '$text' for a text node.

  • position : Position

    The position where the node was removed.

  • type : 'remove'

    The type of diff item.

  • internal

    _element : Element | undefined

    Reference to the model element that was removed.

    Undefined if the diff item is related to text node deletion.

    Note that this element will have the state after all changes has been performed on the model, not before. For example, if a paragraph was first renamed to heading1, and then removed, will be heading1. Similarly, with attributes. Also, you should not read the element's position, as it will no longer point to the original element position.

    Instead, you should use DiffItemRemove#name, DiffItemRemove#attributes, and DiffItemRemove#position.

    This property should be only used to check instance reference equality. For example, if you want to detect that some particular element was removed, you can check _element property. You can use it together with #_element on insert diff items to detect move, refresh, or rename changes.