Report an issue
Module

engine/model/utils/insertcontent

@ckeditor/ckeditor5-engine/src/model/utils/insertcontent

module

Filtering

Classes

  • Insertion

    private

    Utility class for performing content insertion.

Functions

  • insertContent( model, content, [ selectable ], [ placeOrOffset ] )

    static

    Inserts content into the editor (specified selection) as one would expect the paste functionality to work.

    If an instance of Selection is passed as selectable it will be modified to the insertion selection (equal to a range to be selected after insertion).

    Note: Use insertContent instead of this function. This function is only exposed to be reusable in algorithms which change the insertContent method's behavior.

    Parameters

    model : Model

    The model in context of which the insertion should be performed.

    content : DocumentFragment | Item

    The content to insert.

    [ selectable ] : Selection | DocumentSelection | Position | Element | Iterable.<Range> | Range | null

    Selection into which the content should be inserted.

    Defaults to model.document.selection

    [ placeOrOffset ] : Number | 'before' | 'end' | 'after' | 'on' | 'in'

    Sets place or offset of the selection.