Module

list/documentlist/utils/view

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

module

Filtering

Functions

  • internal

    createListElement( writer, indent, type, id ) → AttributeElement

    Creates a list attribute element (ol or ul).

    Parameters

    writer : DowncastWriter
    indent : number
    type : 'numbered' | 'bulleted' | 'todo'
    id : string

    Defaults to ...

    Returns

    AttributeElement
  • internal

    createListItemElement( writer, indent, id ) → AttributeElement

    Creates a list item attribute element (li).

    Parameters

    writer : DowncastWriter
    indent : number
    id : string

    Returns

    AttributeElement
  • internal

    getIndent( listItem ) → number

    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
  • internal

    getViewElementIdForListType( [ type ], [ indent ] ) → string

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

    Parameters

    [ type ] : 'numbered' | 'bulleted' | 'todo'
    [ indent ] : number

    Returns

    string
  • internal

    getViewElementNameForListType( [ type ] ) → 'ol' | 'ul'

    Returns a view element name for the given list type.

    Parameters

    [ type ] : 'numbered' | 'bulleted' | 'todo'

    Returns

    'ol' | 'ul'
  • internal

    isListItemView( viewElement ) → boolean

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

    Parameters

    viewElement : Node | DocumentFragment

    Returns

    boolean
  • internal

    isListView( viewElement ) → boolean

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

    Parameters

    viewElement : Node | DocumentFragment

    Returns

    boolean