SplitOperation (engine/model/operation)
@ckeditor/ckeditor5-engine/src/model/operation/splitoperation
Operation to split an element at given split position into two elements, both containing a part of the element's original content.
Filtering
Properties
-
readonly
affectedSelectable : Selectable
module:engine/model/operation/splitoperation~SplitOperation#affectedSelectable
A selectable that will be affected by the operation after it is executed.
The exact returned parameter differs between operation types.
-
inherited
baseVersion : null | number
module:engine/model/operation/splitoperation~SplitOperation#baseVersion
version
on which operation can be applied. If you try to apply operation with different base version than the document version the model-document-applyOperation-wrong-version error is thrown. -
Batch to which the operation is added or
null
if the operation is not added to any batch yet. -
graveyardPosition : null | Position
module:engine/model/operation/splitoperation~SplitOperation#graveyardPosition
Position in the graveyard root before the element which should be used as a parent of the nodes after
position
. If it is not set, a copy of the theposition
parent will be used.The default behavior is to clone the split element. Element from graveyard is used during undo.
-
howMany : number
module:engine/model/operation/splitoperation~SplitOperation#howMany
Total offset size of elements that are in the split element after
position
. -
insertionPosition : Position
module:engine/model/operation/splitoperation~SplitOperation#insertionPosition
Position at which the clone of split element (or element from graveyard) will be inserted.
-
readonly inherited
isDocumentOperation : boolean
module:engine/model/operation/splitoperation~SplitOperation#isDocumentOperation
Defines whether operation is executed on attached or detached items.
-
readonly
moveTargetPosition : Position
module:engine/model/operation/splitoperation~SplitOperation#moveTargetPosition
Position inside the new clone of a split element.
This is a position where nodes that are after the split position will be moved to.
-
Artificial range that contains all the nodes from the split element that will be moved to the new element. The range starts at
splitPosition
and ends in the same parent, atPOSITIVE_INFINITY
offset. -
splitPosition : Position
module:engine/model/operation/splitoperation~SplitOperation#splitPosition
Position at which an element should be split.
-
Operation type.
Static properties
-
readonly static
className : string
module:engine/model/operation/splitoperation~SplitOperation.className
Name of the operation class used for serialization.
Methods
-
constructor( splitPosition, howMany, insertionPosition, graveyardPosition, baseVersion )
module:engine/model/operation/splitoperation~SplitOperation#constructor
Creates a split operation.
Parameters
splitPosition : Position
Position at which an element should be split.
howMany : number
Total offset size of elements that are in the split element after
position
.insertionPosition : Position
Position at which the clone of split element (or element from graveyard) will be inserted.
graveyardPosition : null | Position
Position in the graveyard root before the element which should be used as a parent of the nodes after
position
. If it is not set, a copy of the theposition
parent will be used.baseVersion : null | number
Document
version
on which operation can be applied ornull
if the operation operates on detached (non-document) tree.
-
clone() → SplitOperation
module:engine/model/operation/splitoperation~SplitOperation#clone
Creates and returns an operation that has the same parameters as this operation.
Returns
SplitOperation
Clone of this operation.
-
getReversed() → Operation
module:engine/model/operation/splitoperation~SplitOperation#getReversed
-
toJSON() → unknown
module:engine/model/operation/splitoperation~SplitOperation#toJSON
Custom toJSON method to solve child-parent circular dependencies.
Returns
unknown
Clone of this object with the operation property replaced with string.
-
Executes the operation - modifications described by the operation properties will be applied to the model tree.
Returns
void
-
Checks whether the operation's parameters are correct and the operation can be correctly executed. Throws an error if operation is not valid.
Returns
void
Static methods
-
static
fromJSON( json, document ) → SplitOperation
module:engine/model/operation/splitoperation~SplitOperation.fromJSON
Creates
SplitOperation
object from deserialized object, i.e. from parsed JSON string.Parameters
json : any
Deserialized JSON object.
document : Document
Document on which this operation will be applied.
Returns
-
static
getInsertionPosition( splitPosition ) → Position
module:engine/model/operation/splitoperation~SplitOperation.getInsertionPosition
Helper function that returns a default insertion position basing on given
splitPosition
. The default insertion position is after the split element.Parameters
splitPosition : Position
Returns
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.