list/documentlist/utils/model
@ckeditor/ckeditor5-list/src/documentlist/utils/model
Filtering
Classes
Interfaces
-
ListElement
module:list/documentlist/utils/model~ListElement
Functions
-
canBecomeSimpleListItem( block, schema ) → boolean
module:list/documentlist/utils/model~canBecomeSimpleListItem
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
Returns
boolean
-
internal
expandListBlocksToCompleteItems( blocks, options = { [options.withNested] } ) → Array<ListElement>
module:list/documentlist/utils/model~expandListBlocksToCompleteItems
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>
module:list/documentlist/utils/model~expandListBlocksToCompleteList
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>
module:list/documentlist/utils/model~getAllListItemBlocks
Returns an array with all elements that represents the same list item.
It means that values for
listIndent
, andlistItemId
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>
module:list/documentlist/utils/model~getListItemBlocks
Returns an array with elements that represents the same list item in the specified direction.
It means that values for
listIndent
andlistItemId
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>
module:list/documentlist/utils/model~getListItems
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>
module:list/documentlist/utils/model~getNestedListBlocks
Returns a list items nested inside the given list item.
Parameters
listItem : Element
Returns
Array<ListElement>
-
internal
getSelectedBlockObject( model ) → Element | null
module:list/documentlist/utils/model~getSelectedBlockObject
-
internal
indentBlocks( blocks, writer, __namedParameters = { [__namedParameters.expand], [__namedParameters.indentBy] } ) → Array<ListElement>
module:list/documentlist/utils/model~indentBlocks
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
module:list/documentlist/utils/model~isFirstBlockOfListItem
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
module:list/documentlist/utils/model~isLastBlockOfListItem
Check if the given block is the last in the list item.
Parameters
listBlock : Element
Returns
boolean
-
internal
isListItemBlock( node ) → node is ListElement
module:list/documentlist/utils/model~isListItemBlock
Returns 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~mergeListItemBefore
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>
module:list/documentlist/utils/model~outdentBlocksWithMerge
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>
module:list/documentlist/utils/model~outdentFollowingItems
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>
module:list/documentlist/utils/model~removeListAttributes
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.
-
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~splitListItemBefore
Splits 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.