list/list/utils
@ckeditor/ckeditor5-list/src/list/utils
Filtering
Functions
-
createUIComponent( editor, commandName, label, icon )
module:list/list/utils~createUIComponent
private
Helper method for creating a UI button and linking it with an appropriate command.
Parameters
editor : Editor
The editor instance to which the UI component will be added.
commandName : String
The name of the command.
label : String
The button label.
icon : String
The source of the icon.
-
createViewListItemElement( writer ) → ContainerElement
module:list/list/utils~createViewListItemElement
Creates a list item
ContainerElement
. -
findNestedList( viewElement ) → Element | null
module:list/list/utils~findNestedList
Returns a first list view element that is direct child of the given view element.
-
generateLiInUl( modelItem, conversionApi ) → ContainerElement
module:list/list/utils~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 : UpcastConversionApi
Conversion interface.
Returns
ContainerElement
View list element.
-
getListTypeFromListStyleType( listStyleType ) → 'bulleted' | 'numbered' | null
module:list/list/utils~getListTypeFromListStyleType
Checks whether the given list-style-type is supported by numbered or bulleted list.
Parameters
listStyleType : String
Returns
'bulleted' | 'numbered' | null
-
getSelectedListItems( model ) → Array.<Element>
module:list/list/utils~getSelectedListItems
protected
Returns an array with all
listItem
elements in the model selection. -
getSiblingListItem( modelItem, options = { [options.sameIndent], [options.smallerIndent], [options.listIndent], [options.direction] } ) → Item | null
module:list/list/utils~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 : Item
options : Object
Search criteria.
Properties[ options.sameIndent ] : Boolean
Whether the sought sibling should have the same indentation.
Defaults to
false
[ options.smallerIndent ] : Boolean
Whether the sought sibling should have a smaller indentation.
Defaults to
false
[ options.listIndent ] : Number
The reference indentation.
[ options.direction ] : 'forward' | 'backward'
Walking direction.
Defaults to
'backward'
Returns
Item | null
-
getSiblingNodes( position, direction ) → Array.<Element>
module:list/list/utils~getSiblingNodes
Returns an array with all
listItem
elements that represent the same list. -
injectViewList( modelItem, injectedItem, conversionApi, model )
module:list/list/utils~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 : Item
Model list item.
injectedItem : ContainerElement
conversionApi : UpcastConversionApi
Conversion interface.
model : Model
The model instance.
-
mergeViewLists( viewWriter, firstList, secondList ) → Position | null
module:list/list/utils~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/list/utils~positionAfterUiElements
Helper function that for a given
view.Position
, returns aview.Position
that is after allview.UIElement
s that are after the given position.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.