engine/model/operation/transform
@ckeditor/ckeditor5-engine/src/model/operation/transform
Filtering
Interfaces
-
TransformSetsResult
module:engine/model/operation/transform~TransformSetsResult
Type Definitions
-
TransformationContext
module:engine/model/operation/transform~TransformationContext
Functions
-
Transforms operation
a
by operationb
.Parameters
a : Operation
Operation to be transformed.
b : Operation
Operation to transform by.
context : TransformationContext
Transformation context for this transformation.
Defaults to
{}
Returns
Array<Operation>
Transformation result.
-
transformSets( operationsA, operationsB, options = { options.document, [options.forceWeakRemove], [options.padWithNoOps], [options.useRelations] } ) → TransformSetsResult
module:engine/model/operation/transform~transformSets
Performs a transformation of two sets of operations -
operationsA
andoperationsB
. The transformation is two-way - both transformedoperationsA
and transformedoperationsB
are returned.Note, that the first operation in each set should base on the same document state ( document version).
It is assumed that
operationsA
are "more important" during conflict resolution between two operations.New copies of both passed arrays and operations inside them are returned. Passed arguments are not altered.
Base versions of the transformed operations sets are updated accordingly. For example, assume that base versions are
4
and there are3
operations inoperationsA
and5
operations inoperationsB
. Then:- transformed
operationsA
will start from base version9
(4
base version +5
operations B), - transformed
operationsB
will start from base version7
(4
base version +3
operations A).
If no operation was broken into two during transformation, then both sets will end up with an operation that bases on version
11
:- transformed
operationsA
start from9
and there are3
of them, so the last will havebaseVersion
equal to11
, - transformed
operationsB
start from7
and there are5
of them, so the last will havebaseVersion
equal to11
.
Parameters
operationsA : Array<Operation>
operationsB : Array<Operation>
options : object
Additional transformation options.
Propertiesoptions.document : Document
Document which the operations change.
[ options.forceWeakRemove ] : boolean
If set to
false
, remove operation will be always stronger than move operation, so the removed nodes won't end up back in the document root. When set totrue
, context data will be used.[ options.padWithNoOps ] : boolean
Whether additional
NoOperation
s should be added to the transformation results to force the same last base version for both transformed sets (in case if some operations got broken into multiple operations during transformation).[ options.useRelations ] : boolean
Whether during transformation relations should be used (used during undo for better conflict resolution).
Returns
TransformSetsResult
Transformation result.
- transformed
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.