devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
44 lines (43 loc) • 2.15 kB
JavaScript
import { MapCreator } from "../../../../../../../common/utils/map-creator";
import { LeafElementDestination } from "../../destination";
import { NoteProperties, NotePosition } from "../../../../../../../common/model/footnotes/footnote";
import { NumberingFormat } from "../../../../../../../common/model/numbering-lists/list-level-properties";
import { StringUtils } from "@devexpress/utils/lib/utils/string";
import { NotePropertiesDestination } from "../note-properties-destination";
export class SectionLevelFootNotePropertiesDestination extends NotePropertiesDestination {
constructor(data) {
super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal);
}
setProperties(notes) {
this.data.sectionImporter.properties.footNote = notes;
}
}
export class DocumentLevelFootNotePropertiesDestination extends NotePropertiesDestination {
static { this.handlerTable = new MapCreator()
.append(NotePropertiesDestination.handlerTable)
.add('footnote', (data) => new FootNoteSeparatorDestination(data))
.get(); }
constructor(data) {
super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal);
}
get elementHandlerTable() {
return DocumentLevelFootNotePropertiesDestination.handlerTable;
}
setProperties(notes) {
this.data.documentModel.sections[0].sectionProperties.footNote = notes;
}
}
class FootNoteSeparatorDestination extends LeafElementDestination {
async processElementOpen(reader) {
const id = reader.getAttributeNS("id", this.data.constants.wordProcessingNamespaceConst);
if (!StringUtils.isNullOrEmpty(id))
this.data.footNotesImporter.separatorIds.push(id);
}
}
export class SectionFootNoteColumnsCountDestination extends LeafElementDestination {
async processElementOpen(reader) {
const noteProps = this.data.sectionImporter.properties.footNote ?? new NoteProperties();
noteProps.columnCount = this.data.readerHelper.getWpSTIntegerValue(reader, "val", 1);
this.data.sectionImporter.properties.footNote = noteProps;
}
}