Trilium Frontend API
    Preparing search index...

    Class Batch

    A batch instance groups model changes (module:engine/model/operation/operation~Operation operations). All operations grouped in a single batch can be reverted together, so you can also 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 module:engine/model/model~Model#enqueueChange:

    model.enqueueChange( batch, writer => {
    writer.insertText( 'foo', paragraph, 'end' );
    } );
    • module:engine/model/model~Model#enqueueChange
    • module:engine/model/model~Model#change

    Implements

    Index

    Constructors

    • Creates a batch instance.

      Parameters

      • Optionaltype: BatchType

        A set of flags that specify the type of the batch. Batch type can alter how some of the features work when encountering a given Batch instance (for example, when a feature listens to applied operations).

      Returns Batch

      • module:engine/model/model~Model#enqueueChange
      • module:engine/model/model~Model#change

    Properties

    isLocal: boolean

    Whether the batch includes operations created locally (true) or operations created on other, remote editors (false).

    isTyping: boolean

    Whether the batch includes operations connected with typing.

    isUndo: boolean

    Whether the batch was created by the undo feature and undoes other operations.

    isUndoable: boolean

    Whether the batch can be undone through the undo feature.

    operations: Operation[]

    An array of operations that compose this batch.

    Accessors

    • get baseVersion(): number

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

      Returns number

    Methods

    • Adds an operation to the batch instance.

      Parameters

      Returns Operation

      The added operation.