devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
25 lines (24 loc) • 1.21 kB
JavaScript
import { MapCreator } from '../../../../../../common/utils/map-creator';
import { StringUtils } from '@devexpress/utils/lib/utils/string';
import { AltChunkInfo } from '../../model/alt-chunk-info';
import { ElementDestination } from '../destination';
import { AltChunkPropertiesDestination } from './alt-chunk-properties-destination';
export class AltChunkDestination extends ElementDestination {
static { this.handlerTable = new MapCreator()
.add('altChunkPr', (data) => new AltChunkPropertiesDestination(data))
.get(); }
get elementHandlerTable() {
return AltChunkDestination.handlerTable;
}
async processElementOpen(reader) {
const id = reader.getAttributeNS('id', this.data.constants.relsNamespaceConst);
if (!StringUtils.isNullOrEmpty(id))
this.relId = id;
}
processElementClose(_reader) {
if (!StringUtils.isNullOrEmpty(this.relId)) {
this.data.altChunkImporter.altChunkInfos.push(new AltChunkInfo(this.relId, this.data.subDocumentInfo.positionImporter.currPosition, this.data.subDocument));
this.data.subDocumentInfo.paragraphImporter.insertParagraph();
}
}
}