Module

paste-from-office/filters/list

@ckeditor/ckeditor5-paste-from-office/src/filters/list

module

Filtering

Functions

  • fixListIndentation( documentFragment, writer )

    static

    Fix structure of nested lists to follow HTML guidelines and normalize content in predictable way.

    1. Move nested lists to have sure that list items are the only children of lists.

       before:                           after:
       OL                                OL
       |-> LI                            |-> LI
       |-> OL                                |-> OL
           |-> LI                                |-> LI
    2. Remove additional indentation which cannot be recreated in HTML structure.

       before:                           after:
       OL                                OL
       |-> LI                            |-> LI
           |-> OL                            |-> OL
               |-> OL                            |-> LI
               |   |-> OL                        |-> LI
               |       |-> OL
               |           |-> LI
               |-> LI
      
       before:                           after:
       OL                                OL
       |-> OL                             |-> LI
           |-> OL
                |-> OL
                    |-> LI

    Parameters

    documentFragment : DocumentFragment
    writer : UpcastWriter
  • transformListItemLikeElementsIntoLists( documentFragment, stylesString )

    static

    Transforms Word specific list-like elements to the semantic HTML lists.

    Lists in Word are represented by block elements with special attributes like:

    <p class=MsoListParagraphCxSpFirst style='mso-list:l1 level1 lfo1'>...</p> // Paragraph based list.
    <h1 style='mso-list:l0 level1 lfo1'>...</h1> // Heading 1 based list.

    Parameters

    documentFragment : DocumentFragment

    The view structure which to transform.

    stylesString : String

    Styles from which list-like elements styling will be extracted.

  • unwrapParagraphInListItem( documentFragment, writer )

    static

    Removes paragraph wrapping content inside a list item.

    Parameters

    documentFragment : DocumentFragment
    writer : UpcastWriter