UNPKG

pptx-automizer

Version:

A template based pptx generator

34 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const xml_helper_1 = require("./xml-helper"); class HyperlinkElement { constructor(doc, relId, isInternal) { this.doc = doc; this.relId = relId; this.isInternal = isInternal; } createHlinkClick() { const hlinkClick = this.doc.createElement('a:hlinkClick'); hlinkClick.setAttribute('r:id', this.relId); hlinkClick.setAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); if (this.isInternal) { hlinkClick.setAttribute('action', 'ppaction://hlinksldjump'); hlinkClick.setAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); hlinkClick.setAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main'); } return hlinkClick; } createTextRun(text) { const run = this.doc.createElement('a:r'); const rPr = this.doc.createElement('a:rPr'); const t = this.doc.createElement('a:t'); rPr.appendChild(this.createHlinkClick()); // Sanitize text for XML 1.0 t.textContent = xml_helper_1.XmlHelper.sanitizeText(text); run.appendChild(rPr); run.appendChild(t); return run; } } exports.default = HyperlinkElement; //# sourceMappingURL=modify-hyperlink-element.js.map