RichText/Archived/Rooster/Rooster.gcomp/Support/node_modules/roosterjs/dist/rooster-amd.js
/**
 * Apply format to an HTML element
 * @param element The HTML element to apply format to
 * @param format The format to apply
 */
Apply format to an HTML element
@param element The HTML element to apply format to
@param format The format to apply
Apply format to an HTML element @param element The HTML element to apply format to @param format The format to apply
function applyFormat(element, format, isDarkMode) {
    if (format) {
        var elementStyle = element.style;
        var fontFamily = format.fontFamily, fontSize = format.fontSize, textColor = format.textColor, textColors = format.textColors, backgroundColor = format.backgroundColor, backgroundColors = format.backgroundColors, bold = format.bold, italic = format.italic, underline = format.underline;
        if (fontFamily) {
            elementStyle.fontFamily = fontFamily;
        }
        if (fontSize) {
            elementStyle.fontSize = fontSize;
        }
        if (textColor || textColors) {
            if (textColors && isDarkMode) {
                element.dataset.ogsc = textColors.lightModeColor;
            }
            elementStyle.color = textColor;
        }
        if (backgroundColor || backgroundColors) {
            if (backgroundColors && isDarkMode) {
                element.dataset.ogsb = backgroundColors.lightModeColor;
            }
            elementStyle.backgroundColor = backgroundColor;
        }
        if (bold) {
            elementStyle.fontWeight = 'bold';
        }
        if (italic) {
            elementStyle.fontStyle = 'italic';
        }
        if (underline) {
            elementStyle.textDecoration = 'underline';
        }
    }
}
function applyFormat ( element , format , isDarkMode ) { if ( format ) { var elementStyle = element . style ; var fontFamily = format . fontFamily , fontSize = format . fontSize , textColor = format . textColor , textColors = format . textColors , backgroundColor = format . backgroundColor , backgroundColors = format . backgroundColors , bold = format . bold , italic = format . italic , underline = format . underline ; if ( fontFamily ) { elementStyle . fontFamily = fontFamily ; } if ( fontSize ) { elementStyle . fontSize = fontSize ; } if ( textColor || textColors ) { if ( textColors && isDarkMode ) { element . dataset . ogsc = textColors . lightModeColor ; } elementStyle . color = textColor ; } if ( backgroundColor || backgroundColors ) { if ( backgroundColors && isDarkMode ) { element . dataset . ogsb = backgroundColors . lightModeColor ; } elementStyle . backgroundColor = backgroundColor ; } if ( bold ) { elementStyle . fontWeight = 'bold' ; } if ( italic ) { elementStyle . fontStyle = 'italic' ; } if ( underline ) { elementStyle . textDecoration = 'underline' ; } } }
Apply format to an HTML element
 @param element The HTML element to apply format to
 @param format The format to apply
Apply format to an HTML element @param element The HTML element to apply format to @param format The format to apply