list/documentlist/utils/model
@ckeditor/ckeditor5-list/src/documentlist/utils/model
Filtering
Classes
Interfaces
-
ListElementmodule:list/documentlist/utils/model~ListElement
Functions
-
canBecomeSimpleListItem( block, schema ) → booleanmodule:list/documentlist/utils/model~canBecomeSimpleListItemChecks 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
Returns
boolean
-
internal
expandListBlocksToCompleteItems( blocks, options = { [options.withNested] } ) → Array<ListElement>module:list/documentlist/utils/model~expandListBlocksToCompleteItemsExpands 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 ] : booleanWhether should include nested list items.
Defaults to
{}
Returns
Array<ListElement>
-
internal
expandListBlocksToCompleteList( blocks ) → Array<ListElement>module:list/documentlist/utils/model~expandListBlocksToCompleteListExpands 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>module:list/documentlist/utils/model~getAllListItemBlocksReturns an array with all elements that represents the same list item.
It means that values for
listIndent, andlistItemIdfor all items are equal.Parameters
listItem : NodeStarting list item element.
options : object-
Properties
[ options.higherIndent ] : booleanWhether 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>module:list/documentlist/utils/model~getListItemBlocksReturns an array with elements that represents the same list item in the specified direction.
It means that values for
listIndentandlistItemIdfor 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 : NodeStarting list item element.
options : object-
Properties
[ options.direction ] : 'forward' | 'backward'Walking direction.
[ options.higherIndent ] : booleanWhether 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>module:list/documentlist/utils/model~getListItemsReturns array of all blocks/items of the same list as given block (same indent, same type and properties).
Parameters
listItem : ElementStarting list item element.
Returns
Array<ListElement>
-
internal
getNestedListBlocks( listItem ) → Array<ListElement>module:list/documentlist/utils/model~getNestedListBlocksReturns a list items nested inside the given list item.
Parameters
listItem : Element
Returns
Array<ListElement>
-
internal
getSelectedBlockObject( model ) → Element | nullmodule:list/documentlist/utils/model~getSelectedBlockObject -
internal
indentBlocks( blocks, writer, __namedParameters = { [__namedParameters.expand], [__namedParameters.indentBy] } ) → Array<ListElement>module:list/documentlist/utils/model~indentBlocksIncreases indentation of given list blocks.
Parameters
blocks : ArrayOrItem<ListElement>The block or iterable of blocks.
writer : WriterThe model writer.
__namedParameters : object-
Properties
[ __namedParameters.expand ] : boolean[ __namedParameters.indentBy ] : number
Defaults to
{}
Returns
Array<ListElement>
-
internal
isFirstBlockOfListItem( listBlock ) → booleanmodule:list/documentlist/utils/model~isFirstBlockOfListItemCheck if the given block is the first in the list item.
Parameters
listBlock : NodeThe list block element.
Returns
boolean
-
internal
isLastBlockOfListItem( listBlock ) → booleanmodule:list/documentlist/utils/model~isLastBlockOfListItemCheck if the given block is the last in the list item.
Parameters
listBlock : Element
Returns
boolean
-
internal
isListItemBlock( node ) → node is ListElementmodule:list/documentlist/utils/model~isListItemBlockReturns true if the given model node is a list item block.
Parameters
node : null | DocumentFragment | Item
Returns
node is ListElement
-
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>module:list/documentlist/utils/model~mergeListItemBeforeMerges the list item with the parent list item.
Parameters
listBlock : NodeThe list block element.
parentBlock : ElementThe list block element to merge with.
writer : WriterThe model writer.
Returns
Array<ListElement>The array of updated blocks.
-
internal
outdentBlocksWithMerge( blocks, writer ) → Array<ListElement>module:list/documentlist/utils/model~outdentBlocksWithMergeDecreases 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 : WriterThe model writer.
Returns
Array<ListElement>
-
internal
outdentFollowingItems( lastBlock, writer ) → Array<ListElement>module:list/documentlist/utils/model~outdentFollowingItemsModifies 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 : ElementThe last list block that has become a non-list element.
writer : WriterThe model writer.
Returns
Array<ListElement>Array of altered blocks.
-
internal
removeListAttributes( blocks, writer ) → Array<Element>module:list/documentlist/utils/model~removeListAttributesRemoves all list attributes from the given blocks.
Parameters
blocks : ArrayOrItem<Element>The block or iterable of blocks.
writer : WriterThe model writer.
Returns
Array<Element>Array of altered blocks.
-
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>module:list/documentlist/utils/model~splitListItemBeforeSplits the list item just before the provided list block.
Parameters
Returns
Array<ListElement>The array of updated blocks.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.