Module

engine/model/utils/getselectedcontent

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

module

Filtering

Functions

  • internal

    getSelectedContent( model, selection ) → ModelDocumentFragment

    Gets a clone of the selected content.

    For example, for the following selection:

    <p>x</p><quote><p>y</p><h>fir[st</h></quote><p>se]cond</p><p>z</p>
    

    It will return a document fragment with such a content:

    <quote><h>st</h></quote><p>se</p>
    

    Parameters

    model : Model

    The model in context of which the selection modification should be performed.

    selection : ModelSelection | ModelDocumentSelection

    The selection of which content will be returned.

    Returns

    ModelDocumentFragment