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 28 29 30 31 32 33 34 | 1x 1x 2855x 2855x 16x 2839x 102x 1984x 1844x 140x 140x 8x 8x | import { wrapAllChildNodes } from '../../domUtils/moveChildNodes'; import type { FormatHandler } from '../FormatHandler'; import type { ItalicFormat } from 'roosterjs-content-model-types'; /** * @internal */ export const italicFormatHandler: FormatHandler<ItalicFormat> = { parse: (format, element, context, defaultStyle) => { const fontStyle = element.style.fontStyle || defaultStyle.fontStyle; if (fontStyle == 'italic' || fontStyle == 'oblique') { format.italic = true; } else if (fontStyle == 'initial' || fontStyle == 'normal') { format.italic = false; } }, apply: (format, element, context) => { if (typeof format.italic === 'undefined') { return; } const implicitItalic = context.implicitFormat.italic; if (!!implicitItalic != !!format.italic) { Eif (format.italic) { wrapAllChildNodes(element, 'i'); } else { element.style.fontStyle = 'normal'; } } }, }; |