DifferItemInsert
A single diff item for inserted nodes.
Properties
-
module:engine/model/differ~DifferItemInsert#action
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>
module:engine/model/differ~DifferItemInsert#attributes
Map of attributes of the inserted element.
-
before : object | undefined
module:engine/model/differ~DifferItemInsert#before
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'
andbefore.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
module:engine/model/differ~DifferItemInsert#length
The length of an inserted text node. For elements, it is always 1 as each inserted element is counted as a one.
-
name : string
module:engine/model/differ~DifferItemInsert#name
The name of the inserted elements or
'$text'
for a text node. -
module:engine/model/differ~DifferItemInsert#position
The position where the node was inserted.
-
type : 'insert'
module:engine/model/differ~DifferItemInsert#type
The type of diff item.