UNPKG

devexpress-richedit

Version:

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

41 lines (40 loc) 1.9 kB
import { NotePosition } from "../../../../../../../common/model/footnotes/footnote"; import { NumberingFormat } from "../../../../../../../common/model/numbering-lists/list-level-properties"; import { MapCreator } from "../../../../../../../common/utils/map-creator"; import { StringUtils } from "@devexpress/utils/lib/utils/string"; import { LeafElementDestination } from "../../destination"; import { NotePropertiesDestination } from "../note-properties-destination"; export class SectionLevelEndNotePropertiesDestination extends NotePropertiesDestination { constructor(data) { super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal); } setProperties(notes) { this.data.sectionImporter.properties.endNote = notes; } } export class DocumentLevelEndNotePropertiesDestination extends NotePropertiesDestination { static { this.handlerTable = new MapCreator() .append(NotePropertiesDestination.handlerTable) .add('endnote', (data) => new EndNoteSeparatorDestination(data)) .get(); } constructor(data) { super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal); } get elementHandlerTable() { return DocumentLevelEndNotePropertiesDestination.handlerTable; } setProperties(notes) { this.data.documentModel.sections[0].sectionProperties.endNote = notes; } async processElementClose(reader) { super.processElementClose(reader); this.data.documentModel.documentEndNotePosition = this.notes.position; } } class EndNoteSeparatorDestination extends LeafElementDestination { async processElementOpen(reader) { const id = reader.getAttributeNS("id", this.data.constants.wordProcessingNamespaceConst); if (!StringUtils.isNullOrEmpty(id)) this.data.endNotesImporter.separatorIds.push(id); } }