Batch (engine/model)
@ckeditor/ckeditor5-engine/src/model/batch
A batch instance groups model changes (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 enqueueChange
:
model.enqueueChange( batch, writer => {
writer.insertText( 'foo', paragraph, 'end' );
} );
Filtering
Properties
-
baseVersion : Number | null
module:engine/model/batch~Batch#baseVersion
readonly
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
. -
isLocal : Boolean
module:engine/model/batch~Batch#isLocal
readonly
Whether the batch includes operations created locally (
true
) or operations created on other, remote editors (false
). -
isTyping : Boolean
module:engine/model/batch~Batch#isTyping
readonly
Whether the batch includes operations connected with typing.
-
isUndo : Boolean
module:engine/model/batch~Batch#isUndo
readonly
Whether the batch was created by the undo feature and undoes other operations.
-
isUndoable : Boolean
module:engine/model/batch~Batch#isUndoable
readonly
Whether the batch can be undone through the undo feature.
-
operations : Array.<Operation>
module:engine/model/batch~Batch#operations
readonly
An array of operations that compose this batch.
-
type : 'default'
module:engine/model/batch~Batch#type
deprecated
The type of the batch.
This property has been deprecated and is always set to the
'default'
value.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 ] = { [type.isUndoable], [type.isLocal], [type.isUndo], [type.isTyping] } )
module:engine/model/batch~Batch#constructor
Creates a batch instance.
Parameters
[ type ] : Object
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).Properties[ type.isUndoable ] : Boolean
Whether a batch can be undone through undo feature.
Defaults to
true
[ type.isLocal ] : Boolean
Whether a batch includes operations created locally (
true
) or operations created on other, remote editors (false
).Defaults to
true
[ type.isUndo ] : Boolean
Whether a batch was created by the undo feature and undoes other operations.
Defaults to
false
[ type.isTyping ] : Boolean
Whether a batch includes operations connected with a typing action.
Defaults to
false
Related:
-
addOperation( operation ) → Operation
module:engine/model/batch~Batch#addOperation
Adds an operation to the batch instance.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.