docxml
Version:
TypeScript (component) library for building and parsing a DOCX file
50 lines (49 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tab = void 0;
const Component_js_1 = require("../classes/Component.js");
const components_js_1 = require("../utilities/components.js");
const dom_js_1 = require("../utilities/dom.js");
const namespaces_js_1 = require("../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.
*/
class Tab extends Component_js_1.Component {
/**
* Creates an XML DOM node for this component instance.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
toNode(_ancestry) {
return (0, dom_js_1.create)(`
element ${namespaces_js_1.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({});
}
}
exports.Tab = Tab;
Object.defineProperty(Tab, "children", {
enumerable: true,
configurable: true,
writable: true,
value: []
});
Object.defineProperty(Tab, "mixed", {
enumerable: true,
configurable: true,
writable: true,
value: false
});
(0, components_js_1.registerComponent)(Tab);