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 35 36 37 | 1x 320x 320x 13x 13x 9x 9x 49x 49x 465x 33x | import type { FormatHandler } from '../FormatHandler';
import type { VerticalAlignFormat } from 'roosterjs-content-model-types';
/**
* @internal
*/
export const verticalAlignFormatHandler: FormatHandler<VerticalAlignFormat> = {
parse: (format, element) => {
const align = element.style.verticalAlign || element.getAttribute('valign');
switch (align) {
case 'baseline':
case 'initial':
case 'super':
case 'sub':
case 'text-top':
case 'text-bottom':
case 'top':
format.verticalAlign = 'top';
break;
case 'bottom':
format.verticalAlign = 'bottom';
break;
case 'middle':
format.verticalAlign = 'middle';
break;
}
},
apply: (format, element) => {
if (format.verticalAlign) {
element.style.verticalAlign = format.verticalAlign;
}
},
};
|