Module

list/documentlist/utils/model

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

module

Filtering

Classes

  • internal

    ListItemUid

Interfaces

  • ListElement

Functions

  • canBecomeSimpleListItem( block, schema ) → boolean

    Checks whether the given block can be replaced by a listItem.

    Note that this is possible only when multiBlock = false option is set in feature config.

    Parameters

    block : Element

    A block to be tested.

    schema : Schema

    The schema of the document.

    Returns

    boolean
  • internal

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

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

    Parameters

    blocks : ArrayOrItem<Element>

    The list of selected blocks.

    options : object
    Properties
    [ options.withNested ] : boolean

    Whether should include nested list items.

    Defaults to {}

    Returns

    Array<ListElement>
  • internal

    expandListBlocksToCompleteList( blocks ) → Array<ListElement>

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

    Parameters

    blocks : ArrayOrItem<Element>

    The list of selected blocks.

    Returns

    Array<ListElement>
  • internal

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

    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 : Node

    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 {}

    Returns

    Array<ListElement>
  • internal

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

    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 : Node

    Starting list item element.

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

    Walking direction.

    [ options.higherIndent ] : boolean

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

    Defaults to {}

    Returns

    Array<ListElement>
  • internal

    getListItems( listItem ) → Array<ListElement>

    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<ListElement>
  • internal

    getNestedListBlocks( listItem ) → Array<ListElement>

    Returns a list items nested inside the given list item.

    Parameters

    listItem : Element

    Returns

    Array<ListElement>
  • internal

    getSelectedBlockObject( model ) → Element | null

    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.

  • internal

    indentBlocks( blocks, writer, __namedParameters = { [__namedParameters.expand], [__namedParameters.indentBy] } ) → Array<ListElement>

    Increases indentation of given list blocks.

    Parameters

    blocks : ArrayOrItem<ListElement>

    The block or iterable of blocks.

    writer : Writer

    The model writer.

    __namedParameters : object
    Properties
    [ __namedParameters.expand ] : boolean
    [ __namedParameters.indentBy ] : number

    Defaults to {}

    Returns

    Array<ListElement>
  • internal

    isFirstBlockOfListItem( listBlock ) → boolean

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

    Parameters

    listBlock : Node

    The list block element.

    Returns

    boolean
  • internal

    isLastBlockOfListItem( listBlock ) → boolean

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

    Parameters

    listBlock : Element

    Returns

    boolean
  • internal

    isListItemBlock( node ) → node is ListElement

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

    Parameters

    node : null | DocumentFragment | Item

    Returns

    node is ListElement
  • internal

    isSingleListItem( blocks ) → boolean

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

    Parameters

    blocks : Array<Node>

    The list block elements.

    Returns

    boolean
  • internal

    mergeListItemBefore( listBlock, parentBlock, writer ) → Array<ListElement>

    Merges the list item with the parent list item.

    Parameters

    listBlock : Node

    The list block element.

    parentBlock : Element

    The list block element to merge with.

    writer : Writer

    The model writer.

    Returns

    Array<ListElement>

    The array of updated blocks.

  • internal

    outdentBlocksWithMerge( blocks, writer ) → Array<ListElement>

    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 : ArrayOrItem<ListElement>

    The block or iterable of blocks.

    writer : Writer

    The model writer.

    Returns

    Array<ListElement>
  • internal

    outdentFollowingItems( lastBlock, writer ) → Array<ListElement>

    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<ListElement>

    Array of altered blocks.

  • internal

    removeListAttributes( blocks, writer ) → Array<Element>

    Removes all list attributes from the given blocks.

    Parameters

    blocks : ArrayOrItem<Element>

    The block or iterable of blocks.

    writer : Writer

    The model writer.

    Returns

    Array<Element>

    Array of altered blocks.

  • internal

    sortBlocks( blocks ) → Array<T>

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

    Type parameters

    T : extends Element<T>

    Parameters

    blocks : Iterable<T>

    Returns

    Array<T>
  • internal

    splitListItemBefore( listBlock, writer ) → Array<ListElement>

    Splits the list item just before the provided list block.

    Parameters

    listBlock : Element

    The list block element.

    writer : Writer

    The model writer.

    Returns

    Array<ListElement>

    The array of updated blocks.