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 | 1x 1x 6723x 6723x 1067x 1696x 227x 1696x 3x | import { isElementOfType } from '../../domUtils/isElementOfType';
import type { DirectionFormat } from 'roosterjs-content-model-types';
import type { FormatHandler } from '../FormatHandler';
/**
* @internal
*/
export const directionFormatHandler: FormatHandler<DirectionFormat> = {
parse: (format, element, _, defaultStyle) => {
const dir = element.style.direction || element.dir || defaultStyle.direction;
if (dir) {
format.direction = dir == 'rtl' ? 'rtl' : 'ltr';
}
},
apply: (format, element) => {
if (format.direction) {
element.style.direction = format.direction;
}
if (format.direction == 'rtl' && isElementOfType(element, 'table')) {
element.style.justifySelf = 'flex-end';
}
},
};
|