CKEDITOR.plugins.pastetools.filters.word.heuristics
Filtering
Methods
private
assignListLevels( editor, item ) → Object | nullCKEDITOR.plugins.pastetools.filters.word.heuristics#assignListLevelsAssigns list levels to the
itemand all directly subsequent nodes for which isEdgeListItem returnstrue.The algorithm determines list item level based on the lowest common non-zero difference in indentation of two or more subsequent list-like elements.
Parameters
editor : editoritem : elementThe first item of the list.
Returns
Object | nullnullif list levels were already applied, or an object used to verify results in tests.Propertiesindents : Number[]levels : Number[]diffs : Number[]
since 4.7.0 private
cleanupEdgeListItem( item )CKEDITOR.plugins.pastetools.filters.word.heuristics#cleanupEdgeListItemCleans up a given list
item. It is needed to remove Edge pre-marker indentation, since Edge pastes list items as plain paragraphs with multiple s before the list marker.Parameters
item : elementThe pre-processed list-like item, like a paragraph.
private
correctLevelShift( element )CKEDITOR.plugins.pastetools.filters.word.heuristics#correctLevelShiftShifts lists that were deformed during pasting one level down so that the list structure matches the content copied from Word.
Parameters
element : element
private
guessIndentationStep( indentations ) → Number | nullCKEDITOR.plugins.pastetools.filters.word.heuristics#guessIndentationStepGiven an array of list indentations, this method tries to guess what the indentation difference per list level is. E.g. assuming that you have something like:
* foo (indentation 30px) * bar (indentation 90px) * baz (indentation 90px) * baz (indentation 115px) * baz (indentation 60px)The method will return
30.Parameters
indentations : Number[]An array of indentation sizes.
Returns
Number | nullA number or
nullif emptyindentationswas given.private
isDegenerateListItem( editor, item ) → BooleanCKEDITOR.plugins.pastetools.filters.word.heuristics#isDegenerateListItemChecks whether an element is a degenerate list item.
Degenerate list items are elements that have some styles specific to list items, but lack the ones that could be used to determine their features (like list level etc.).
Parameters
editor : editoritem : element
Returns
Boolean
private
isEdgeListItem( editor, item ) → BooleanCKEDITOR.plugins.pastetools.filters.word.heuristics#isEdgeListItemDecides if an
itemlooks like a list item in Microsoft Edge.Note: It will return
falsewhen run in a browser other than Microsoft Edge, despite the configuration.Parameters
editor : editoritem : element
Returns
Boolean
Determines if the list is malformed in a manner that its items are one level deeper than they should be.
Parameters
element : element
Returns
Boolean