UNPKG

devexpress-richedit

Version:

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

65 lines (64 loc) 2.81 kB
import { AnchorObjectTextWrapSide, AnchorObjectTextWrapType } from '../../../../../../common/model/floating-objects/enums'; import { StringUtils } from '@devexpress/utils/lib/utils/string'; import { TranslationTables } from '../../../translation-table/translation-tables'; import { LeafElementDestination } from '../destination'; export class DrawingAnchorWrapNoneDestination extends LeafElementDestination { anchorDestination; constructor(data, anchorDestination) { super(data); this.anchorDestination = anchorDestination; } async processElementOpen(_reader) { this.anchorDestination.floatingObject.wrapType = AnchorObjectTextWrapType.None; } } export class DrawingAnchorWrapTopAndBottomDestination extends LeafElementDestination { anchorDestination; constructor(data, anchorDestination) { super(data); this.anchorDestination = anchorDestination; } async processElementOpen(_reader) { this.anchorDestination.floatingObject.wrapType = AnchorObjectTextWrapType.TopAndBottom; } } export class DrawingAnchorPolygonDestinationBase extends LeafElementDestination { anchorDestination; constructor(data, anchorDestination) { super(data); this.anchorDestination = anchorDestination; } async processElementOpen(reader) { const value = reader.getAttribute('wrapText'); if (!StringUtils.isNullOrEmpty(value)) { this.anchorDestination.floatingObject.wrapSide = this.data.readerHelper.getWpEnumValueCore(value, TranslationTables.floatingObjectTextWrapSideTable.importMap, AnchorObjectTextWrapSide.Both); } } } export class DrawingAnchorWrapSquareDestination extends DrawingAnchorPolygonDestinationBase { constructor(data, anchorDestination) { super(data, anchorDestination); } async processElementOpen(reader) { super.processElementOpen(reader); this.anchorDestination.floatingObject.wrapType = AnchorObjectTextWrapType.Square; } } export class DrawingAnchorWrapThroughDestination extends DrawingAnchorPolygonDestinationBase { constructor(data, anchorDestination) { super(data, anchorDestination); } async processElementOpen(reader) { super.processElementOpen(reader); this.anchorDestination.floatingObject.wrapType = AnchorObjectTextWrapType.Through; } } export class DrawingAnchorWrapTightDestination extends DrawingAnchorPolygonDestinationBase { constructor(data, anchorDestination) { super(data, anchorDestination); } async processElementOpen(reader) { super.processElementOpen(reader); this.anchorDestination.floatingObject.wrapType = AnchorObjectTextWrapType.Tight; } }