engine/model/utils/getselectedcontent

Api-module icon module

Functions

  • Chevron-right icon

    getSelectedContent( model, selection ) → ModelDocumentFragment
    internal

    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>
    
    Copy code

    It will return a document fragment with such a content:

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

    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