list/legacylist/legacyutils
Functions
createViewListItemElement( writer ) → ViewContainerElementinternalmodule:list/legacylist/legacyutils~createViewListItemElementCreates a list item
ViewContainerElement.Parameters
writer : ViewDowncastWriterThe writer instance.
Returns
findNestedList( viewElement ) → null | ViewElementinternalmodule:list/legacylist/legacyutils~findNestedListReturns a first list view element that is direct child of the given view element.
Parameters
viewElement : ViewElement
Returns
null | ViewElement
generateLiInUl( modelItem, conversionApi ) → ViewContainerElementinternalmodule:list/legacylist/legacyutils~generateLiInUlHelper function that creates a
<ul><li></li></ul>or (<ol>) structure out of the givenmodelItemmodellistItemelement. Then, it binds the created view list item (<li>) with the modellistItemelement. The function then returns the created view list item (<li>).Parameters
modelItem : ModelItemModel list item.
conversionApi : DowncastConversionApiConversion interface.
Returns
ViewContainerElementView list element.
getListTypeFromListStyleType( listStyleType ) → null | 'numbered' | 'bulleted'internalmodule:list/legacylist/legacyutils~getListTypeFromListStyleTypeChecks whether the given list-style-type is supported by numbered or bulleted list.
Parameters
listStyleType : string
Returns
null | 'numbered' | 'bulleted'
getSelectedListItems( model ) → Array<ModelElement>internalmodule:list/legacylist/legacyutils~getSelectedListItemsReturns an array with all
listItemelements 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<ModelElement>
getSiblingListItem( modelItem, options = { [options.direction], [options.listIndent], [options.sameIndent], [options.smallerIndent] } ) → null | ModelElementinternalmodule:list/legacylist/legacyutils~getSiblingListItemHelper 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 | ModelItemoptions : objectSearch criteria.
Properties[ options.direction ] : 'forward' | 'backward'Walking direction.
[ options.listIndent ] : numberThe reference indentation.
[ options.sameIndent ] : booleanWhether the sought sibling should have the same indentation.
[ options.smallerIndent ] : booleanWhether the sought sibling should have a smaller indentation.
Returns
null | ModelElement
getSiblingNodes( position, direction ) → Array<ModelElement>internalmodule:list/legacylist/legacyutils~getSiblingNodesReturns an array with all
listItemelements that represent the same list.It means that values of
listIndent,listType,listStyle,listReversedandlistStartfor all items are equal.Additionally, if the
positionis inside a list item, that list item will be returned as well.Parameters
position : ModelPositionStarting position.
direction : 'forward' | 'backward'Walking direction.
Returns
Array<ModelElement>
injectViewList( modelItem, injectedItem, conversionApi, model ) → voidinternalmodule:list/legacylist/legacyutils~injectViewListHelper 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 : ModelElementModel list item.
injectedItem : ViewContainerElementconversionApi : DowncastConversionApiConversion interface.
model : ModelThe model instance.
Returns
void
mergeViewLists( viewWriter, firstList, secondList ) → null | ViewPositioninternalmodule:list/legacylist/legacyutils~mergeViewListsHelper 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 : ViewDowncastWriterThe writer instance.
firstList : ViewItemThe first element to compare.
secondList : ViewItemThe second element to compare.
Returns
null | ViewPositionThe position after merge or
nullwhen there was no merge.
positionAfterUiElements( viewPosition ) → ViewPositioninternalmodule:list/legacylist/legacyutils~positionAfterUiElementsHelper function that for a given
view.Position, returns aview.Positionthat is after allview.UIElements 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 : ViewPosition
Returns