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

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

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              1x       2x 1x      
import type { ContentModelBlockFormat, FormatParser } from 'roosterjs-content-model-types';
 
/**
 * @internal
 * For block elements that have background color style, remove the background color when user selects the merge current format
 * paste option
 */
export const blockElementParser: FormatParser<ContentModelBlockFormat> = (
    format: ContentModelBlockFormat,
    element: HTMLElement
) => {
    if (element.style.backgroundColor) {
        delete format.backgroundColor;
    }
};