History (engine/model)
@ckeditor/ckeditor5-engine/src/model/history
History
keeps the track of all the operations applied to the document.
Filtering
Properties
-
_operations : Array.<Operation>
protected
Operations added to the history.
-
_undoPairs : Map
private
-
_undoneOperations : Set.<Operation>
private
Holds all undone operations.
Methods
-
Creates an empty History instance.
-
addOperation( operation )
Adds an operation to the history.
Parameters
operation : Operation
Operation to add.
-
getOperation( baseVersion ) → Operation | null
Returns operation from the history that bases on given
baseVersion
.Parameters
baseVersion : Number
Base version of the operation to get.
Returns
Operation | null
Operation with given base version or
null
if there is no such operation in history.
-
getOperations( [ from ], [ to ] ) → Iterable.<Operation>
Returns operations added to the history.
Parameters
[ from ] : Number
Base version from which operations should be returned (inclusive). Defaults to
0
, which means that operations from the first one will be returned.Defaults to
0
[ to ] : Number
Base version up to which operations should be returned (exclusive). Defaults to
Number.POSITIVE_INFINITY
which means that operations up to the last one will be returned.Defaults to
Number.POSITIVE_INFINITY
Returns
Iterable.<Operation>
Operations added to the history.
-
getUndoneOperation( undoingOperation ) → Operation | undefined
-
isUndoingOperation( operation ) → Boolean
Checks whether given
operation
is undoing any other operation.Parameters
operation : Operation
Operation to check.
Returns
Boolean
true
if givenoperation
is undoing any other operation,false
otherwise.
-
isUndoneOperation( operation ) → Boolean
Checks whether given
operation
has been undone by any other operation.Parameters
operation : Operation
Operation to check.
Returns
Boolean
true
if givenoperation
has been undone any other operation,false
otherwise.
-
setOperationAsUndone( undoneOperation, undoingOperation )
Marks in history that one operation is an operation that is undoing the other operation. By marking operation this way, history is keeping more context information about operations, which helps in operational transformation.