UNPKG

devexpress-richedit

Version:

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

28 lines (27 loc) 1.24 kB
import { HtmlTagImporterBase } from './base'; import { ImportedTextRunInfo } from '../containers/runs'; import { StringUtils } from '@devexpress/utils/lib/utils/string'; import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed'; import { RichUtils } from '../../../../model/rich-utils'; export class HtmlSpanTagImporter extends HtmlTagImporterBase { constructor() { super(...arguments); this.importChilds = true; } elementTag() { return "SPAN"; } importBefore() { const tabCountStr = this.element.getAttribute('style')?.split(';').find(e => e.startsWith('mso-tab-count:'))?.replace('mso-tab-count:', ''); if (tabCountStr) { const count = parseInt(tabCountStr); this.importer.addRun(new ImportedTextRunInfo(this.importer.modelManager.model, this.importer.measurer, StringUtils.repeat(RichUtils.specialCharacters.TabMark, count), this.importer.htmlImporterMaskedCharacterProperties.getBundleFrom(this.element, new FixedInterval(this.importer.currPosition, count)))); this.importChilds = false; } } isImportChildren() { return this.importChilds; } importAfter() { } }