All files / roosterjs-content-model-plugins/lib/paste/parsers listLevelParser.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27                            1x           101x 39x     101x    
import type {
    ContentModelListItemLevelFormat,
    DomToModelContext,
    FormatParser,
} from 'roosterjs-content-model-types';
 
/**
 * @internal
 * Parser for processing list level formatting specific to Word Desktop
 * @param format The list item level format to modify
 * @param element The HTML element being processed
 * @param _context The DOM to model context
 * @param defaultStyle The default style properties
 */
export const listLevelParser: FormatParser<ContentModelListItemLevelFormat> = (
    format: ContentModelListItemLevelFormat,
    element: HTMLElement,
    _context: DomToModelContext,
    defaultStyle: Readonly<Partial<CSSStyleDeclaration>>
) => {
    if (element.style.marginLeft !== '') {
        format.marginLeft = defaultStyle.marginLeft;
    }
 
    format.marginBottom = undefined;
};