Report an issue
Class

Delta (engine/model/delta)

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

class

Base class for all deltas.

Delta is a single, from the user action point of view, change in the editable document, like insert, split or rename element. Delta is composed of operations, which are unit changes needed to be done to execute user action.

Multiple deltas are grouped into a single Batch.

Filtering

Properties

  • baseVersion

  • batch : Batch

    readonly

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

  • operations : Array.<Operation>

    readonly

    Array of operations which compose delta.

  • type : String

    readonly

    Delta type.

  • _reverseDeltaClass : function

    private

    A class that will be used when creating reversed delta.

Static properties

  • className : String

    readonly static

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

Methods

  • constructor()

    Creates a delta instance.

  • addOperation( operation )

    Add operation to the delta.

    Parameters

    operation : Operation

    Operation instance.

  • clone() → Delta

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

    Returns

    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.

    Returns

    Delta

    Reversed delta.

  • toJSON() → Object

    Custom toJSON method to make deltas serializable.

    Returns

    Object

    Clone of this delta with added class name.