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 | 1x 1x 1377x 1377x 130x 1153x 1153x 93x | import { shouldSetValue } from '../utils/shouldSetValue'; import type { FormatHandler } from '../FormatHandler'; import type { WhiteSpaceFormat } from 'roosterjs-content-model-types'; /** * @internal */ export const whiteSpaceFormatHandler: FormatHandler<WhiteSpaceFormat> = { parse: (format, element, _, defaultStyle) => { const whiteSpace = element.style.whiteSpace || defaultStyle.whiteSpace; if (shouldSetValue(whiteSpace, 'normal', format.whiteSpace, defaultStyle.whiteSpace)) { format.whiteSpace = whiteSpace; } }, apply: (format, element, context) => { const whiteSpace = context.implicitFormat.whiteSpace; if (format.whiteSpace != whiteSpace) { element.style.whiteSpace = format.whiteSpace || 'normal'; } }, }; |