Module

list/documentlist/utils/view

@ckeditor/ckeditor5-list/src/documentlist/utils/view

module

Filtering

Functions

  • createListElement( writer, indent, type ) → AttributeElement

    protected

    Creates a list attribute element (ol or ul).

    Parameters

    writer : DowncastWriter

    The downcast writer.

    indent : Number

    The list item indent.

    type : 'bulleted' | 'numbered'

    The list type.

    Returns

    AttributeElement
  • createListItemElement( writer, indent, id ) → AttributeElement

    protected

    Creates a list item attribute element (li).

    Parameters

    writer : DowncastWriter

    The downcast writer.

    indent : Number

    The list item indent.

    id : String

    The list item ID.

    Returns

    AttributeElement
  • getIndent( listItem ) → Number

    protected

    Calculates the indent value for a list item. Handles HTML compliant and non-compliant lists.

    Also, fixes non HTML compliant lists indents:

    before:                                     fixed list:
    OL                                          OL
    |-> LI (parent LIs: 0)                      |-> LI     (indent: 0)
        |-> OL                                  |-> OL
            |-> OL                                  |
            |   |-> OL                              |
            |       |-> OL                          |
            |           |-> LI (parent LIs: 1)      |-> LI (indent: 1)
            |-> LI (parent LIs: 1)                  |-> LI (indent: 1)
    
    before:                                     fixed list:
    OL                                          OL
    |-> OL                                      |
        |-> OL                                  |
             |-> OL                             |
                 |-> LI (parent LIs: 0)         |-> LI        (indent: 0)
    
    before:                                     fixed list:
    OL                                          OL
    |-> LI (parent LIs: 0)                      |-> LI         (indent: 0)
    |-> OL                                          |-> OL
        |-> LI (parent LIs: 0)                          |-> LI (indent: 1)

    Parameters

    listItem : Element

    Returns

    Number
  • getViewElementIdForListType( type, indent ) → String

    protected

    Returns a view element ID for the given list type and indent.

    Parameters

    type : 'bulleted' | 'numbered'

    The list type.

    indent : Number

    The list indent level.

    Returns

    String
  • getViewElementNameForListType( type ) → String

    protected

    Returns a view element name for the given list type.

    Parameters

    type : 'bulleted' | 'numbered'

    The list type.

    Returns

    String
  • isListItemView( viewElement ) → Boolean

    protected

    Checks if view element is a list item (li).

    Parameters

    viewElement : Element

    Returns

    Boolean
  • isListView( viewElement ) → Boolean

    protected

    Checks if view element is a list type (ul or ol).

    Parameters

    viewElement : Element

    Returns

    Boolean