mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
27 lines
762 B
TypeScript
27 lines
762 B
TypeScript
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
|
import {Context} from '../../core/context';
|
|
export enum TEXT_ALIGN {
|
|
LEFT = 0,
|
|
CENTER = 1,
|
|
RIGHT = 2
|
|
}
|
|
|
|
export const textAlign: IPropertyIdentValueDescriptor<TEXT_ALIGN> = {
|
|
name: 'text-align',
|
|
initialValue: 'left',
|
|
prefix: false,
|
|
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
|
parse: (_context: Context, textAlign: string) => {
|
|
switch (textAlign) {
|
|
case 'right':
|
|
return TEXT_ALIGN.RIGHT;
|
|
case 'center':
|
|
case 'justify':
|
|
return TEXT_ALIGN.CENTER;
|
|
case 'left':
|
|
default:
|
|
return TEXT_ALIGN.LEFT;
|
|
}
|
|
}
|
|
};
|