UNPKG

docxml

Version:

TypeScript (component) library for building and parsing a DOCX file

46 lines (45 loc) 1.31 kB
import { Component } from '../classes/Component.js'; import { registerComponent } from '../utilities/components.js'; import { create } from '../utilities/dom.js'; import { QNS } from '../utilities/namespaces.js'; /** * A component that represents a tab space in a DOCX document. Place * this in one of the `<Text>`, `<TextAddition>` or `<TextDeletion>` components. */ export class Tab extends Component { /** * Creates an XML DOM node for this component instance. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars toNode(_ancestry) { return create(` element ${QNS.w}tab {} `, {}); } /** * Asserts whether or not a given XML node correlates with this component. */ static matchesNode(node) { return node.nodeName === 'w:tab'; } /** * Instantiate this component from the XML in an existing DOCX file. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars static fromNode(_node) { return new Tab({}); } } Object.defineProperty(Tab, "children", { enumerable: true, configurable: true, writable: true, value: [] }); Object.defineProperty(Tab, "mixed", { enumerable: true, configurable: true, writable: true, value: false }); registerComponent(Tab);