UNPKG

devexpress-richedit

Version:

DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.

20 lines (19 loc) 994 B
import { MapCreator } from '../../../../../../common/utils/map-creator'; import { StringUtils } from '@devexpress/utils/lib/utils/string'; import { ElementDestination, LeafElementDestination } from '../destination'; export class DocumentSettingsDocVarsDestination extends ElementDestination { static { this.handlerTable = new MapCreator() .add('docVar', (data) => new DocumentSettingsDocVarDestination(data)) .get(); } get elementHandlerTable() { return DocumentSettingsDocVarsDestination.handlerTable; } } export class DocumentSettingsDocVarDestination extends LeafElementDestination { async processElementOpen(reader) { const name = this.data.readerHelper.readAttribute(reader, 'name'); const value = this.data.readerHelper.readAttribute(reader, 'val'); if (!StringUtils.isNullOrEmpty(name) && !StringUtils.isNullOrEmpty(value)) this.data.documentModel.docVariables.addValue(name, value); } }