Module

list/documentlist/utils/model

@ckeditor/ckeditor5-list/src/documentlist/utils/model

module

Filtering

Classes

  • ListItemUid

    protected

    The list item ID generator.

Functions

  • expandListBlocksToCompleteItems( blocks, [ options ] = { [options.withNested] } ) → Array.<Element>

    protected

    Expands the given list of selected blocks to include the leading and tailing blocks of partially selected list items.

    Parameters

    blocks : Element | Array.<Element>

    The list of selected blocks.

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

    Whether should include nested list items.

    Defaults to true

    Returns

    Array.<Element>
  • expandListBlocksToCompleteList( blocks ) → Array.<Element>

    protected

    Expands the given list of selected blocks to include all the items of the lists they're in.

    Parameters

    blocks : Element | Array.<Element>

    The list of selected blocks.

    Returns

    Array.<Element>
  • getAllListItemBlocks( listItem, [ options ] = { [options.higherIndent] } ) → Array.<Element>

    protected

    Returns an array with all elements that represents the same list item.

    It means that values for listIndent, and listItemId for all items are equal.

    Parameters

    listItem : Element

    Starting list item element.

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

    Whether blocks with a higher indent level than the start block should be included in the result.

    Defaults to false

    Returns

    Array.<Element>
  • getListItemBlocks( listItem, [ options ] = { [options.direction], [options.higherIndent] } ) → Array.<Element>

    protected

    Returns an array with elements that represents the same list item in the specified direction.

    It means that values for listIndent and listItemId for all items are equal.

    Note: For backward search the provided item is not included, but for forward search it is included in the result.

    Parameters

    listItem : Element

    Starting list item element.

    [ options ] : Object
    Properties
    [ options.direction ] : 'forward' | 'backward'

    Walking direction.

    Defaults to 'backward'

    [ options.higherIndent ] : Boolean

    Whether blocks with a higher indent level than the start block should be included in the result.

    Defaults to false

    Returns

    Array.<Element>
  • getListItems( listItem ) → Array.<Element>

    protected

    Returns array of all blocks/items of the same list as given block (same indent, same type and properties).

    Parameters

    listItem : Element

    Starting list item element.

    Returns

    Array.<Element>
  • getNestedListBlocks( listItem ) → Array.<Element>

    protected

    Returns a list items nested inside the given list item.

    Parameters

    listItem : Element

    Starting list item element.

    Returns

    Array.<Element>
  • getSelectedBlockObject( model ) → Element | null

    protected

    Returns a selected block object. If a selected object is inline or when there is no selected object, null is returned.

    Parameters

    model : Model

    The instance of editor model.

    Returns

    Element | null

    Selected block object or null.

  • indentBlocks( blocks, writer, [ options ] = { [options.expand], [options.indentBy] } )

    protected

    Increases indentation of given list blocks.

    Parameters

    blocks : Element | Iterable.<Element>

    The block or iterable of blocks.

    writer : Writer

    The model writer.

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

    Whether should expand the list of blocks to include complete list items.

    Defaults to false

    [ options.indentBy ] : Number

    The number of levels the indentation should change (could be negative).

    Defaults to 1

  • isFirstBlockOfListItem( listBlock ) → Boolean

    protected

    Check if the given block is the first in the list item.

    Parameters

    listBlock : Element

    The list block element.

    Returns

    Boolean
  • isLastBlockOfListItem( listBlock ) → Boolean

    protected

    Check if the given block is the last in the list item.

    Parameters

    listBlock : Element

    The list block element.

    Returns

    Boolean
  • isListItemBlock( node ) → Boolean

    protected

    Returns true if the given model node is a list item block.

    Parameters

    node : Node

    A model node.

    Returns

    Boolean
  • isSingleListItem( blocks ) → Boolean

    protected

    Checks whether the given blocks are related to a single list item.

    Parameters

    blocks : Array.<Element>

    The list block elements.

    Returns

    Boolean
  • mergeListItemBefore( listBlock, parentBlock, writer ) → Array.<Element>

    protected

    Merges the list item with the parent list item.

    Parameters

    listBlock : Element

    The list block element.

    parentBlock : Element

    The list block element to merge with.

    writer : Writer

    The model writer.

    Returns

    Array.<Element>

    The array of updated blocks.

  • outdentBlocksWithMerge( blocks, writer )

    protected

    Decreases indentation of given list of blocks. If the indentation of some blocks matches the indentation of surrounding blocks, they get merged together.

    Parameters

    blocks : Element | Iterable.<Element>

    The block or iterable of blocks.

    writer : Writer

    The model writer.

  • outdentFollowingItems( lastBlock, writer ) → Array.<Element>

    protected

    Modifies the indents of list blocks following the given list block so the indentation is valid after the given block is no longer a list item.

    Parameters

    lastBlock : Element

    The last list block that has become a non-list element.

    writer : Writer

    The model writer.

    Returns

    Array.<Element>

    Array of altered blocks.

  • removeListAttributes( blocks, writer ) → Array.<Element>

    protected

    Removes all list attributes from the given blocks.

    Parameters

    blocks : Element | Iterable.<Element>

    The block or iterable of blocks.

    writer : Writer

    The model writer.

    Returns

    Array.<Element>

    Array of altered blocks.

  • sortBlocks( blocks ) → Array.<Element>

    protected

    Returns the array of given blocks sorted by model indexes (document order).

    Parameters

    blocks : Iterable.<Element>

    The array of blocks.

    Returns

    Array.<Element>

    The sorted array of blocks.

  • splitListItemBefore( listBlock, writer ) → Array.<Element>

    protected

    Splits the list item just before the provided list block.

    Parameters

    listBlock : Element

    The list block element.

    writer : Writer

    The model writer.

    Returns

    Array.<Element>

    The array of updated blocks.