Module

engine/model/utils/getselectedcontent

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

module

Filtering

Functions

  • getSelectedContent( model, selection ) → DocumentFragment

    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 : Selection | DocumentSelection

    The selection of which content will be returned.

    Returns

    DocumentFragment