SplitOperation
Operation to split an element at given split position into two elements, both containing a part of the element's original content.
Properties
affectedSelectable : ModelSelectablereadonlymodule:engine/model/operation/splitoperation~SplitOperation#affectedSelectableA selectable that will be affected by the operation after it is executed.
The exact returned parameter differs between operation types.
baseVersion : null | numberinheritedmodule:engine/model/operation/splitoperation~SplitOperation#baseVersionversionon 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.module:engine/model/operation/splitoperation~SplitOperation#batchBatch to which the operation is added or
nullif the operation is not added to any batch yet.Note, that a non-document operation has this property always set to
null, and is never added to any batch.graveyardPosition : null | ModelPositionmodule:engine/model/operation/splitoperation~SplitOperation#graveyardPositionPosition 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 thepositionparent will be used.The default behavior is to clone the split element. Element from graveyard is used during undo.
howMany : numbermodule:engine/model/operation/splitoperation~SplitOperation#howManyTotal offset size of elements that are in the split element after
position.module:engine/model/operation/splitoperation~SplitOperation#insertionPositionPosition at which the clone of split element (or element from graveyard) will be inserted.
isDocumentOperation : booleanreadonlyinheritedmodule:engine/model/operation/splitoperation~SplitOperation#isDocumentOperationDefines whether operation is executed on attached or detached items.
moveTargetPosition : ModelPositionreadonlymodule:engine/model/operation/splitoperation~SplitOperation#moveTargetPositionPosition 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 : ModelRangereadonlymodule:engine/model/operation/splitoperation~SplitOperation#movedRangeArtificial range that contains all the nodes from the split element that will be moved to the new element. The range starts at
splitPositionand ends in the same parent, atPOSITIVE_INFINITYoffset.module:engine/model/operation/splitoperation~SplitOperation#splitPositionPosition at which an element should be split.
type : 'split'readonlymodule:engine/model/operation/splitoperation~SplitOperation#typeOperation type.
Static properties
className : stringreadonlystaticmodule:engine/model/operation/splitoperation~SplitOperation.classNameName of the operation class used for serialization.
Methods
constructor( splitPosition, howMany, insertionPosition, graveyardPosition, baseVersion )module:engine/model/operation/splitoperation~SplitOperation#constructorCreates a split operation.
Parameters
splitPosition : ModelPositionPosition at which an element should be split.
howMany : numberTotal offset size of elements that are in the split element after
position.insertionPosition : ModelPositionPosition at which the clone of split element (or element from graveyard) will be inserted.
graveyardPosition : null | ModelPositionPosition 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 thepositionparent will be used.baseVersion : null | numberDocument
versionon which operation can be applied ornullif the operation operates on detached (non-document) tree.
clone() → SplitOperationmodule:engine/model/operation/splitoperation~SplitOperation#cloneCreates and returns an operation that has the same parameters as this operation.
Returns
SplitOperationClone of this operation.
getReversed() → Operationmodule:engine/model/operation/splitoperation~SplitOperation#getReversedtoJSON() → unknownmodule:engine/model/operation/splitoperation~SplitOperation#toJSONCustom toJSON method to solve child-parent circular dependencies.
Returns
unknownClone of this object with the operation property replaced with string.
_execute() → voidinternalmodule:engine/model/operation/splitoperation~SplitOperation#_executeExecutes the operation - modifications described by the operation properties will be applied to the model tree.
Returns
void
_validate() → voidinternalmodule:engine/model/operation/splitoperation~SplitOperation#_validateChecks 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
fromJSON( json, document ) → SplitOperationstaticmodule:engine/model/operation/splitoperation~SplitOperation.fromJSONCreates
SplitOperationobject from deserialized object, i.e. from parsed JSON string.Parameters
json : anyDeserialized JSON object.
document : ModelDocumentDocument on which this operation will be applied.
Returns
getInsertionPosition( splitPosition ) → ModelPositionstaticmodule:engine/model/operation/splitoperation~SplitOperation.getInsertionPositionHelper function that returns a default insertion position basing on given
splitPosition. The default insertion position is after the split element.Parameters
splitPosition : ModelPosition
Returns