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
-
baseVersion : Number
module:engine/model/operation/splitoperation~SplitOperation#baseVersion
inherited
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 : Position | null
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.
-
isDocumentOperation : Boolean
module:engine/model/operation/splitoperation~SplitOperation#isDocumentOperation
readonly inherited
Defines whether operation is executed on attached or detached items.
-
moveTargetPosition : Position
module:engine/model/operation/splitoperation~SplitOperation#moveTargetPosition
readonly
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.
-
movedRange : Range
module:engine/model/operation/splitoperation~SplitOperation#movedRange
readonly
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.
-
type : String
module:engine/model/operation/splitoperation~SplitOperation#type
readonly inherited
Operation type.
Static properties
-
className : String
module:engine/model/operation/splitoperation~SplitOperation.className
inherited static
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 : Position | null
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 : Number | null
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() → MergeOperation
module:engine/model/operation/splitoperation~SplitOperation#getReversed
Returns
-
toJSON() → Object
module:engine/model/operation/splitoperation~SplitOperation#toJSON
inherited
Custom toJSON method to solve child-parent circular dependencies.
Returns
Object
Clone of this object with the operation property replaced with string.
-
_execute()
module:engine/model/operation/splitoperation~SplitOperation#_execute
protected inherited
Executes the operation - modifications described by the operation properties will be applied to the model tree.
-
_validate()
module:engine/model/operation/splitoperation~SplitOperation#_validate
protected inherited
Checks whether the operation's parameters are correct and the operation can be correctly executed. Throws an error if operation is not valid.
Static methods
-
fromJSON( json, document ) → SplitOperation
module:engine/model/operation/splitoperation~SplitOperation.fromJSON
static
Creates
SplitOperation
object from deserilized object, i.e. from parsed JSON string.Parameters
json : Object
Deserialized JSON object.
document : Document
Document on which this operation will be applied.
Returns
-
getInsertionPosition( splitPosition ) → Position
module:engine/model/operation/splitoperation~SplitOperation.getInsertionPosition
static
Helper function that returns a default insertion position basing on given
splitPosition
. The default insertion position is after the split element.
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.