Report an issue

SplitDelta (engine/model/delta)



To provide specific OT behavior and better collisions solving, the split method uses SplitDelta class which inherits from the Delta class and may overwrite some methods.



  • baseVersion : Number | null


    Returns delta base version which is equal to the base version of the first operation in delta. If there are no operations in delta, returns null.

    Overrides: Delta#baseVersion
  • batch : Batch

    readonly inherited

    Batch which delta is a part of. This property is null by default and set by the addDelta method.

  • operations : Array.<Operation>

    readonly inherited

    Array of operations which compose delta.

  • position : Position | null

    Position of split or null if there are no operations in the delta.

  • type : String

    readonly inherited

    Delta type.

    Overrides: Delta#type
  • _cloneOperation : InsertOperation | ReinsertOperation | null


    Operation in the delta that adds to model an element into which split nodes will be moved, or null if there are no operations in the delta.

    Most commonly this will be an insert operation, as SplitDelta has to create a new node. If SplitDelta was created through reversing a merge delta, this will be a reinsert operation, as we will want to re-insert the exact element that was removed by that merge delta.

  • _moveOperation : MoveOperation | null


    Operation in the delta that moves model items, that are after split position, to their new parent or null if there are no operations in the delta.

  • _reverseDeltaClass : function

    private inherited

    A class that will be used when creating reversed delta.

Static properties

  • className : String

    readonly inherited static

    Delta class name. Used by toJSON method for serialization and fromJSON during deserialization.


  • constructor()


    Creates a delta instance.

  • addOperation( operation )


    Add operation to the delta.


    operation : Operation

    Operation instance.

  • clone() → Delta


    Creates and returns a delta that has the same parameters as this delta.



    Clone of this delta.

  • getReversed() → Delta


    Creates and returns a reverse delta. Reverse delta when executed right after the original delta will bring back tree model state to the point before the original delta execution. In other words, it reverses changes done by the original delta.

    Keep in mind that tree model state may change since executing the original delta, so reverse delta may be "outdated". In that case you will need to transform it by all deltas that were executed after the original delta.



    Reversed delta.

  • toJSON() → Object


    Custom toJSON method to make deltas serializable.



    Clone of this delta with added class name.