Class

SplitOperation (engine/model/operation)

@ckeditor/ckeditor5-engine/src/model/operation/splitoperation

class

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

    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

    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.

  • inherited

    batch : null | Batch

    Batch to which the operation is added or null if the operation is not added to any batch yet.

  • 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 the position parent will be used.

    The default behavior is to clone the split element. Element from graveyard is used during undo.

  • 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.

  • readonly inherited

    isDocumentOperation : boolean

    Defines whether operation is executed on attached or detached items.

  • readonly

    moveTargetPosition : Position

    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.

  • readonly

    movedRange : Range

    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, at POSITIVE_INFINITY offset.

  • splitPosition : Position

    Position at which an element should be split.

  • readonly

    type : 'split'

    Operation type.

Static properties

  • readonly static

    className : string

    Name of the operation class used for serialization.

Methods

  • constructor( splitPosition, howMany, insertionPosition, graveyardPosition, baseVersion )

    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 the position parent will be used.

    baseVersion : null | number

    Document version on which operation can be applied or null if the operation operates on detached (non-document) tree.

  • clone() → SplitOperation

    Creates and returns an operation that has the same parameters as this operation.

    Returns

    SplitOperation

    Clone of this operation.

  • getReversed() → Operation

  • toJSON() → unknown

    Custom toJSON method to solve child-parent circular dependencies.

    Returns

    unknown

    Clone of this object with the operation property replaced with string.

  • internal

    _execute() → void

    Executes the operation - modifications described by the operation properties will be applied to the model tree.

    Returns

    void
  • internal

    _validate() → 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

    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

    SplitOperation
  • static

    getInsertionPosition( splitPosition ) → Position

    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

    Position