devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
24 lines (23 loc) • 1.15 kB
JavaScript
import { CharacterPropertyDescriptor } from '../../../../../../../common/model/character/character-property-descriptor';
import { CharacterFormattingScript } from '../../../../../../../common/model/character/enums';
import { DocxNsType } from '../../../../utils/constants';
import { CharacterFormattingLeafElementDestination } from '../character-formatting-leaf-element-destination';
export class FontScriptDestination extends CharacterFormattingLeafElementDestination {
async processElementOpen(reader) {
const value = reader.getAttributeNS('val', this.data.constants.namespaces[DocxNsType.WordProcessing].namespace);
switch (value) {
case 'baseline':
this.setProperty(CharacterFormattingScript.Normal);
break;
case 'subscript':
this.setProperty(CharacterFormattingScript.Subscript);
break;
case 'superscript':
this.setProperty(CharacterFormattingScript.Superscript);
break;
}
}
getDescriptor() {
return CharacterPropertyDescriptor.script;
}
}