Report an issue
Class

Batch (engine/model)

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

class

A batch instance groups model changes (deltas). All deltas grouped in a single batch can be reverted together, so you can think about a batch as of a single undo step. If you want to extend a given undo step, you can add more changes to the batch using enqueueChange:

model.enqueueChange( batch, writer => {
    writer.insertText( 'foo', paragraph, 'end' );
} );

Filtering

Properties

  • baseVersion : Number | null

    readonly

    Returns the base version of this batch, which is equal to the base version of the first delta (which has the base version set) in the batch. If there are no deltas in the batch or neither delta has the base version set, it returns null.

  • deltas : Array.<Delta>

    readonly

    An array of deltas that compose this batch.

  • type : 'transparent' | 'default'

    readonly

    The type of the batch.

    It can be one of the following values:

    • 'default' – All "normal" batches. This is the most commonly used type.
    • 'transparent' – A batch that should be ignored by other features, i.e. an initial batch or collaborative editing changes.

Methods

  • constructor( [ type ] )

    Creates a batch instance.

    Parameters

    [ type ] : 'transparent' | 'default'

    The type of the batch.

    Defaults to 'default'

  • addDelta( delta ) → Delta

    Adds a delta to the batch instance. All modification methods (insert, remove, split, etc.) use this method to add created deltas.

    Parameters

    delta : Delta

    A delta to add.

    Returns

    Delta

    An added delta.

  • getOperations() → Iterable.<Operation>

    Gets an iterable collection of operations.

    Returns

    Iterable.<Operation>