DiffItemRemove (engine/model)
@ckeditor/ckeditor5-engine/src/model/differ
A single diff item for removed nodes.
Filtering
Properties
-
attributes : Map<string, unknown>
module:engine/model/differ~DiffItemRemove#attributes
Map of attributes that were set on the item while it was removed.
-
length : number
module:engine/model/differ~DiffItemRemove#length
The length of a removed text node. For elements, it is always 1, as each removed element is counted as a one.
-
name : string
module:engine/model/differ~DiffItemRemove#name
The name of the removed element or
'$text'
for a text node. -
The position where the node was removed.
-
type : 'remove'
module:engine/model/differ~DiffItemRemove#type
The type of diff item.
-
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,element.name
will beheading1
. 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
, andDiffItemRemove#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.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.