InsertOperation
Operation to insert one or more nodes at given position in the model.
Properties
affectedSelectable : ModelSelectablereadonlymodule:engine/model/operation/insertoperation~InsertOperation#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/insertoperation~InsertOperation#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/insertoperation~InsertOperation#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.howMany : numberreadonlymodule:engine/model/operation/insertoperation~InsertOperation#howManyTotal offset size of inserted nodes.
isDocumentOperation : booleanreadonlyinheritedmodule:engine/model/operation/insertoperation~InsertOperation#isDocumentOperationDefines whether operation is executed on attached or detached items.
nodes : ModelNodeListreadonlymodule:engine/model/operation/insertoperation~InsertOperation#nodesList of nodes to insert.
position : ModelPositionreadonlymodule:engine/model/operation/insertoperation~InsertOperation#positionPosition of insertion.
shouldReceiveAttributes : booleanmodule:engine/model/operation/insertoperation~InsertOperation#shouldReceiveAttributesFlag deciding how the operation should be transformed. If set to
true, nodes might get additional attributes during operational transformation. This happens when the operation insertion position is inside of a range where attributes have changed.type : 'insert'readonlymodule:engine/model/operation/insertoperation~InsertOperation#typeOperation type.
Static properties
className : stringreadonlystaticmodule:engine/model/operation/insertoperation~InsertOperation.classNameName of the operation class used for serialization.
Methods
constructor( position, nodes, baseVersion )module:engine/model/operation/insertoperation~InsertOperation#constructorCreates an insert operation.
Parameters
position : ModelPositionPosition of insertion.
nodes : ModelNodeSetThe list of nodes to be inserted.
baseVersion : null | numberDocument
versionon which operation can be applied ornullif the operation operates on detached (non-document) tree.
clone() → InsertOperationmodule:engine/model/operation/insertoperation~InsertOperation#cloneCreates and returns an operation that has the same parameters as this operation.
Returns
getReversed() → Operationmodule:engine/model/operation/insertoperation~InsertOperation#getReversedtoJSON() → unknownmodule:engine/model/operation/insertoperation~InsertOperation#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/insertoperation~InsertOperation#_executeExecutes the operation - modifications described by the operation properties will be applied to the model tree.
Returns
void
_validate() → voidinternalmodule:engine/model/operation/insertoperation~InsertOperation#_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 ) → InsertOperationstaticmodule:engine/model/operation/insertoperation~InsertOperation.fromJSONCreates
InsertOperationobject from deserialized object, i.e. from parsed JSON string.Parameters
json : anyDeserialized JSON object.
document : ModelDocumentDocument on which this operation will be applied.
Returns