UNPKG

docxml

Version:

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

41 lines (40 loc) 1.18 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 non-breaking hyphen. Place this in the `<Text>` component. */ export class NonBreakingHyphen extends Component { /** * Creates an XML DOM node for this component instance. */ toNode() { return create(`element ${QNS.w}noBreakHyphen {}`); } /** * Asserts whether or not a given XML node correlates with this component. */ static matchesNode(node) { return node.nodeName === 'w:noBreakHyphen'; } /** * Instantiate this component from the XML in an existing DOCX file. */ static fromNode() { return new NonBreakingHyphen({}); } } Object.defineProperty(NonBreakingHyphen, "children", { enumerable: true, configurable: true, writable: true, value: [] }); Object.defineProperty(NonBreakingHyphen, "mixed", { enumerable: true, configurable: true, writable: true, value: false }); registerComponent(NonBreakingHyphen);