list/legacylist/legacyutils
@ckeditor/ckeditor5-list/src/legacylist/legacyutils
Filtering
Functions
-
createViewListItemElement( writer ) → ContainerElement
module:list/legacylist/legacyutils~createViewListItemElement
Creates a list item
ContainerElement
.Parameters
writer : DowncastWriter
The writer instance.
Returns
-
findNestedList( viewElement ) → Element | null
module:list/legacylist/legacyutils~findNestedList
-
generateLiInUl( modelItem, conversionApi ) → ContainerElement
module:list/legacylist/legacyutils~generateLiInUl
Helper function that creates a
<ul><li></li></ul>
or (<ol>
) structure out of the givenmodelItem
modellistItem
element. Then, it binds the created view list item (<li>
) with the modellistItem
element. The function then returns the created view list item (<li>
).Parameters
modelItem : Item
Model list item.
conversionApi : DowncastConversionApi
Conversion interface.
Returns
ContainerElement
View list element.
-
getListTypeFromListStyleType( listStyleType ) → 'bulleted' | 'numbered' | null
module:list/legacylist/legacyutils~getListTypeFromListStyleType
Checks whether the given list-style-type is supported by numbered or bulleted list.
Parameters
listStyleType : string
Returns
'bulleted' | 'numbered' | null
-
internal
getSelectedListItems( model ) → Array<Element>
module:list/legacylist/legacyutils~getSelectedListItems
Returns an array with all
listItem
elements in the model selection.It returns all the items even if only a part of the list is selected, including items that belong to nested lists. If no list is selected, it returns an empty array. The order of the elements is not specified.
Parameters
model : Model
Returns
Array<Element>
-
getSiblingListItem( modelItem, options = { [options.direction], [options.listIndent], [options.sameIndent], [options.smallerIndent] } ) → Element | null
module:list/legacylist/legacyutils~getSiblingListItem
Helper function that searches for a previous list item sibling of a given model item that meets the given criteria passed by the options object.
Parameters
modelItem : null | Item
options : object
Search criteria.
Properties[ options.direction ] : 'forward' | 'backward'
Walking direction.
[ options.listIndent ] : number
The reference indentation.
[ options.sameIndent ] : boolean
Whether the sought sibling should have the same indentation.
[ options.smallerIndent ] : boolean
Whether the sought sibling should have a smaller indentation.
Returns
Element | null
-
getSiblingNodes( position, direction ) → Array<Element>
module:list/legacylist/legacyutils~getSiblingNodes
Returns an array with all
listItem
elements that represent the same list.It means that values of
listIndent
,listType
,listStyle
,listReversed
andlistStart
for all items are equal.Additionally, if the
position
is inside a list item, that list item will be returned as well.Parameters
position : Position
Starting position.
direction : 'forward' | 'backward'
Walking direction.
Returns
Array<Element>
-
injectViewList( modelItem, injectedItem, conversionApi, model ) → void
module:list/legacylist/legacyutils~injectViewList
Helper function that inserts a view list at a correct place and merges it with its siblings. It takes a model list item element (
modelItem
) and a corresponding view list item element (injectedItem
). The view list item should be in a view list element (<ul>
or<ol>
) and should be its only child. See comments below to better understand the algorithm.Parameters
modelItem : Element
Model list item.
injectedItem : ContainerElement
conversionApi : DowncastConversionApi
Conversion interface.
model : Model
The model instance.
Returns
void
-
mergeViewLists( viewWriter, firstList, secondList ) → Position | null
module:list/legacylist/legacyutils~mergeViewLists
Helper function that takes two parameters that are expected to be view list elements, and merges them. The merge happens only if both parameters are list elements of the same type (the same element name and the same class attributes).
Parameters
viewWriter : DowncastWriter
The writer instance.
firstList : Item
The first element to compare.
secondList : Item
The second element to compare.
Returns
Position | null
The position after merge or
null
when there was no merge.
-
positionAfterUiElements( viewPosition ) → Position
module:list/legacylist/legacyutils~positionAfterUiElements
Helper function that for a given
view.Position
, returns aview.Position
that is after allview.UIElement
s that are after the given position.For example:
<container:p>foo^<ui:span></ui:span><ui:span></ui:span>bar</container:p>
For position ^, the position before "bar" will be returned.Parameters
viewPosition : Position
Returns
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.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.