Report an issue
Module

engine/model/utils/deletecontent

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

module

Filtering

Functions

  • deleteContent( model, selection, batch, [ options ] = { [options.leaveUnmerged], [options.doNotResetEntireContent] } )

    static

    Deletes content of the selection and merge siblings. The resulting selection is always collapsed.

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

    Parameters

    model : Model

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

    selection : Selection | DocumentSelection

    Selection of which the content should be deleted.

    batch : Batch

    Batch to which the deltas will be added.

    [ options ] : Object
    Properties
    [ options.leaveUnmerged ] : Boolean

    Whether to merge elements after removing the content of the selection.

    For example <heading>x[x</heading><paragraph>y]y</paragraph> will become:

    • <heading>x^y</heading> with the option disabled (leaveUnmerged == false)
    • <heading>x^</heading><paragraph>y</paragraph> with enabled (leaveUnmerged == true).

    Note: object and limit elements will not be merged.

    Defaults to false

    [ options.doNotResetEntireContent ] : Boolean

    Whether to skip replacing the entire content with a paragraph when the entire content was selected.

    For example <heading>[x</heading><paragraph>y]</paragraph> will become:

    • <paragraph>^</paragraph> with the option disabled (doNotResetEntireContent == false)
    • <heading>^</heading> with enabled (doNotResetEntireContent == true).

    Defaults to false