pptx-templates 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI-INSTRUCTOR.md +2253 -0
- package/CHANGELOG.md +49 -0
- package/LICENSE +23 -0
- package/README.md +86 -2
- package/dist/automizer.d.ts +224 -0
- package/dist/automizer.js +704 -0
- package/dist/automizer.js.map +1 -0
- package/dist/classes/content-type-registry.d.ts +46 -0
- package/dist/classes/content-type-registry.js +170 -0
- package/dist/classes/content-type-registry.js.map +1 -0
- package/dist/classes/element-importer.d.ts +49 -0
- package/dist/classes/element-importer.js +254 -0
- package/dist/classes/element-importer.js.map +1 -0
- package/dist/classes/has-shapes.d.ts +286 -0
- package/dist/classes/has-shapes.js +385 -0
- package/dist/classes/has-shapes.js.map +1 -0
- package/dist/classes/layout.d.ts +42 -0
- package/dist/classes/layout.js +113 -0
- package/dist/classes/layout.js.map +1 -0
- package/dist/classes/master.d.ts +45 -0
- package/dist/classes/master.js +146 -0
- package/dist/classes/master.js.map +1 -0
- package/dist/classes/placeholder-normalizer.d.ts +42 -0
- package/dist/classes/placeholder-normalizer.js +136 -0
- package/dist/classes/placeholder-normalizer.js.map +1 -0
- package/dist/classes/related-content-copier.d.ts +18 -0
- package/dist/classes/related-content-copier.js +114 -0
- package/dist/classes/related-content-copier.js.map +1 -0
- package/dist/classes/shape.d.ts +62 -0
- package/dist/classes/shape.js +194 -0
- package/dist/classes/shape.js.map +1 -0
- package/dist/classes/slide-master-remover.d.ts +44 -0
- package/dist/classes/slide-master-remover.js +201 -0
- package/dist/classes/slide-master-remover.js.map +1 -0
- package/dist/classes/slide-notes-copier.d.ts +26 -0
- package/dist/classes/slide-notes-copier.js +76 -0
- package/dist/classes/slide-notes-copier.js.map +1 -0
- package/dist/classes/slide.d.ts +91 -0
- package/dist/classes/slide.js +286 -0
- package/dist/classes/slide.js.map +1 -0
- package/dist/classes/template.d.ts +137 -0
- package/dist/classes/template.js +311 -0
- package/dist/classes/template.js.map +1 -0
- package/dist/constants/constants.d.ts +11 -0
- package/dist/constants/constants.js +182 -0
- package/dist/constants/constants.js.map +1 -0
- package/dist/enums/chart-type.d.ts +11 -0
- package/dist/enums/chart-type.js +16 -0
- package/dist/enums/chart-type.js.map +1 -0
- package/dist/enums/content-type-map.d.ts +16 -0
- package/dist/enums/content-type-map.js +23 -0
- package/dist/enums/content-type-map.js.map +1 -0
- package/dist/enums/element-type.d.ts +14 -0
- package/dist/enums/element-type.js +20 -0
- package/dist/enums/element-type.js.map +1 -0
- package/dist/errors.d.ts +81 -0
- package/dist/errors.js +100 -0
- package/dist/errors.js.map +1 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/index.js +31 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.d.ts +5 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js +9 -0
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/index.d.ts +5 -0
- package/dist/extensions/pptxgenjs-compat/index.js +10 -0
- package/dist/extensions/pptxgenjs-compat/index.js.map +1 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.d.ts +14 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js +139 -0
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -0
- package/dist/extensions/template-logic/commands.d.ts +22 -0
- package/dist/extensions/template-logic/commands.js +83 -0
- package/dist/extensions/template-logic/commands.js.map +1 -0
- package/dist/extensions/template-logic/expression.d.ts +61 -0
- package/dist/extensions/template-logic/expression.js +499 -0
- package/dist/extensions/template-logic/expression.js.map +1 -0
- package/dist/extensions/template-logic/images.d.ts +26 -0
- package/dist/extensions/template-logic/images.js +183 -0
- package/dist/extensions/template-logic/images.js.map +1 -0
- package/dist/extensions/template-logic/index.d.ts +14 -0
- package/dist/extensions/template-logic/index.js +64 -0
- package/dist/extensions/template-logic/index.js.map +1 -0
- package/dist/extensions/template-logic/list-commands.d.ts +9 -0
- package/dist/extensions/template-logic/list-commands.js +72 -0
- package/dist/extensions/template-logic/list-commands.js.map +1 -0
- package/dist/extensions/template-logic/renderer.d.ts +85 -0
- package/dist/extensions/template-logic/renderer.js +867 -0
- package/dist/extensions/template-logic/renderer.js.map +1 -0
- package/dist/extensions/template-logic/types.d.ts +62 -0
- package/dist/extensions/template-logic/types.js +3 -0
- package/dist/extensions/template-logic/types.js.map +1 -0
- package/dist/helper/archive/archive-fs.d.ts +45 -0
- package/dist/helper/archive/archive-fs.js +206 -0
- package/dist/helper/archive/archive-fs.js.map +1 -0
- package/dist/helper/archive/archive-jszip.d.ts +31 -0
- package/dist/helper/archive/archive-jszip.js +173 -0
- package/dist/helper/archive/archive-jszip.js.map +1 -0
- package/dist/helper/archive/archive.d.ts +27 -0
- package/dist/helper/archive/archive.js +78 -0
- package/dist/helper/archive/archive.js.map +1 -0
- package/dist/helper/cell-id-helper.d.ts +25 -0
- package/dist/helper/cell-id-helper.js +95 -0
- package/dist/helper/cell-id-helper.js.map +1 -0
- package/dist/helper/compute-src-rect.d.ts +9 -0
- package/dist/helper/compute-src-rect.js +52 -0
- package/dist/helper/compute-src-rect.js.map +1 -0
- package/dist/helper/content-tracker.d.ts +31 -0
- package/dist/helper/content-tracker.js +227 -0
- package/dist/helper/content-tracker.js.map +1 -0
- package/dist/helper/count-helper.d.ts +33 -0
- package/dist/helper/count-helper.js +140 -0
- package/dist/helper/count-helper.js.map +1 -0
- package/dist/helper/css-style-parser.d.ts +52 -0
- package/dist/helper/css-style-parser.js +246 -0
- package/dist/helper/css-style-parser.js.map +1 -0
- package/dist/helper/file-helper.d.ts +36 -0
- package/dist/helper/file-helper.js +150 -0
- package/dist/helper/file-helper.js.map +1 -0
- package/dist/helper/general-helper.d.ts +6 -0
- package/dist/helper/general-helper.js +34 -0
- package/dist/helper/general-helper.js.map +1 -0
- package/dist/helper/generate/generate-pptxgenjs.d.ts +37 -0
- package/dist/helper/generate/generate-pptxgenjs.js +134 -0
- package/dist/helper/generate/generate-pptxgenjs.js.map +1 -0
- package/dist/helper/html-to-multitext-helper.d.ts +84 -0
- package/dist/helper/html-to-multitext-helper.js +490 -0
- package/dist/helper/html-to-multitext-helper.js.map +1 -0
- package/dist/helper/hyperlink-processor.d.ts +54 -0
- package/dist/helper/hyperlink-processor.js +289 -0
- package/dist/helper/hyperlink-processor.js.map +1 -0
- package/dist/helper/image-dimensions.d.ts +21 -0
- package/dist/helper/image-dimensions.js +202 -0
- package/dist/helper/image-dimensions.js.map +1 -0
- package/dist/helper/jszip-helper.d.ts +21 -0
- package/dist/helper/jszip-helper.js +162 -0
- package/dist/helper/jszip-helper.js.map +1 -0
- package/dist/helper/layout-index.d.ts +55 -0
- package/dist/helper/layout-index.js +155 -0
- package/dist/helper/layout-index.js.map +1 -0
- package/dist/helper/logger.d.ts +53 -0
- package/dist/helper/logger.js +73 -0
- package/dist/helper/logger.js.map +1 -0
- package/dist/helper/media-deduplicator.d.ts +42 -0
- package/dist/helper/media-deduplicator.js +88 -0
- package/dist/helper/media-deduplicator.js.map +1 -0
- package/dist/helper/modify-background-helper.d.ts +19 -0
- package/dist/helper/modify-background-helper.js +59 -0
- package/dist/helper/modify-background-helper.js.map +1 -0
- package/dist/helper/modify-chart-helper.d.ts +159 -0
- package/dist/helper/modify-chart-helper.js +642 -0
- package/dist/helper/modify-chart-helper.js.map +1 -0
- package/dist/helper/modify-cleanup-helper.d.ts +69 -0
- package/dist/helper/modify-cleanup-helper.js +343 -0
- package/dist/helper/modify-cleanup-helper.js.map +1 -0
- package/dist/helper/modify-color-helper.d.ts +35 -0
- package/dist/helper/modify-color-helper.js +211 -0
- package/dist/helper/modify-color-helper.js.map +1 -0
- package/dist/helper/modify-helper.d.ts +23 -0
- package/dist/helper/modify-helper.js +61 -0
- package/dist/helper/modify-helper.js.map +1 -0
- package/dist/helper/modify-hyperlink-element.d.ts +9 -0
- package/dist/helper/modify-hyperlink-element.js +34 -0
- package/dist/helper/modify-hyperlink-element.js.map +1 -0
- package/dist/helper/modify-hyperlink-helper.d.ts +42 -0
- package/dist/helper/modify-hyperlink-helper.js +258 -0
- package/dist/helper/modify-hyperlink-helper.js.map +1 -0
- package/dist/helper/modify-image-helper.d.ts +23 -0
- package/dist/helper/modify-image-helper.js +157 -0
- package/dist/helper/modify-image-helper.js.map +1 -0
- package/dist/helper/modify-presentation-helper.d.ts +55 -0
- package/dist/helper/modify-presentation-helper.js +177 -0
- package/dist/helper/modify-presentation-helper.js.map +1 -0
- package/dist/helper/modify-shape-helper.d.ts +111 -0
- package/dist/helper/modify-shape-helper.js +340 -0
- package/dist/helper/modify-shape-helper.js.map +1 -0
- package/dist/helper/modify-table-helper.d.ts +11 -0
- package/dist/helper/modify-table-helper.js +100 -0
- package/dist/helper/modify-table-helper.js.map +1 -0
- package/dist/helper/modify-text-helper.d.ts +62 -0
- package/dist/helper/modify-text-helper.js +244 -0
- package/dist/helper/modify-text-helper.js.map +1 -0
- package/dist/helper/modify-xml-helper.d.ts +52 -0
- package/dist/helper/modify-xml-helper.js +305 -0
- package/dist/helper/modify-xml-helper.js.map +1 -0
- package/dist/helper/multitext-helper.d.ts +116 -0
- package/dist/helper/multitext-helper.js +462 -0
- package/dist/helper/multitext-helper.js.map +1 -0
- package/dist/helper/ppt-paths.d.ts +76 -0
- package/dist/helper/ppt-paths.js +116 -0
- package/dist/helper/ppt-paths.js.map +1 -0
- package/dist/helper/shape-type-detector.d.ts +34 -0
- package/dist/helper/shape-type-detector.js +99 -0
- package/dist/helper/shape-type-detector.js.map +1 -0
- package/dist/helper/text-replace-helper.d.ts +30 -0
- package/dist/helper/text-replace-helper.js +147 -0
- package/dist/helper/text-replace-helper.js.map +1 -0
- package/dist/helper/xml/lnLRTB.d.ts +1 -0
- package/dist/helper/xml/lnLRTB.js +62 -0
- package/dist/helper/xml/lnLRTB.js.map +1 -0
- package/dist/helper/xml/prstGeom.d.ts +1 -0
- package/dist/helper/xml/prstGeom.js +11 -0
- package/dist/helper/xml/prstGeom.js.map +1 -0
- package/dist/helper/xml-elements.d.ts +134 -0
- package/dist/helper/xml-elements.js +538 -0
- package/dist/helper/xml-elements.js.map +1 -0
- package/dist/helper/xml-helper.d.ts +120 -0
- package/dist/helper/xml-helper.js +495 -0
- package/dist/helper/xml-helper.js.map +1 -0
- package/dist/helper/xml-placeholder-helper.d.ts +92 -0
- package/dist/helper/xml-placeholder-helper.js +454 -0
- package/dist/helper/xml-placeholder-helper.js.map +1 -0
- package/dist/helper/xml-pretty-print.d.ts +17 -0
- package/dist/helper/xml-pretty-print.js +88 -0
- package/dist/helper/xml-pretty-print.js.map +1 -0
- package/dist/helper/xml-relationship-helper.d.ts +103 -0
- package/dist/helper/xml-relationship-helper.js +397 -0
- package/dist/helper/xml-relationship-helper.js.map +1 -0
- package/dist/helper/xml-slide-helper.d.ts +107 -0
- package/dist/helper/xml-slide-helper.js +676 -0
- package/dist/helper/xml-slide-helper.js.map +1 -0
- package/dist/helper/xml-template-helper.d.ts +42 -0
- package/dist/helper/xml-template-helper.js +252 -0
- package/dist/helper/xml-template-helper.js.map +1 -0
- package/dist/helper/xmldom-sax-patch.d.ts +18 -0
- package/dist/helper/xmldom-sax-patch.js +58 -0
- package/dist/helper/xmldom-sax-patch.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/iarchive.d.ts +43 -0
- package/dist/interfaces/iarchive.js +3 -0
- package/dist/interfaces/iarchive.js.map +1 -0
- package/dist/interfaces/ichart.d.ts +7 -0
- package/dist/interfaces/ichart.js +3 -0
- package/dist/interfaces/ichart.js.map +1 -0
- package/dist/interfaces/icounter.d.ts +7 -0
- package/dist/interfaces/icounter.js +3 -0
- package/dist/interfaces/icounter.js.map +1 -0
- package/dist/interfaces/igenerator.d.ts +4 -0
- package/dist/interfaces/igenerator.js +3 -0
- package/dist/interfaces/igenerator.js.map +1 -0
- package/dist/interfaces/iimage.d.ts +7 -0
- package/dist/interfaces/iimage.js +3 -0
- package/dist/interfaces/iimage.js.map +1 -0
- package/dist/interfaces/ilayout.d.ts +14 -0
- package/dist/interfaces/ilayout.js +3 -0
- package/dist/interfaces/ilayout.js.map +1 -0
- package/dist/interfaces/imaster.d.ts +15 -0
- package/dist/interfaces/imaster.js +3 -0
- package/dist/interfaces/imaster.js.map +1 -0
- package/dist/interfaces/imulti-text.d.ts +50 -0
- package/dist/interfaces/imulti-text.js +3 -0
- package/dist/interfaces/imulti-text.js.map +1 -0
- package/dist/interfaces/ipptxgenjs-slide.d.ts +40 -0
- package/dist/interfaces/ipptxgenjs-slide.js +3 -0
- package/dist/interfaces/ipptxgenjs-slide.js.map +1 -0
- package/dist/interfaces/ipresentation-props.d.ts +16 -0
- package/dist/interfaces/ipresentation-props.js +3 -0
- package/dist/interfaces/ipresentation-props.js.map +1 -0
- package/dist/interfaces/ishape-action.d.ts +18 -0
- package/dist/interfaces/ishape-action.js +3 -0
- package/dist/interfaces/ishape-action.js.map +1 -0
- package/dist/interfaces/ishape.d.ts +5 -0
- package/dist/interfaces/ishape.js +3 -0
- package/dist/interfaces/ishape.js.map +1 -0
- package/dist/interfaces/islide.d.ts +71 -0
- package/dist/interfaces/islide.js +3 -0
- package/dist/interfaces/islide.js.map +1 -0
- package/dist/interfaces/itemplate.d.ts +9 -0
- package/dist/interfaces/itemplate.js +3 -0
- package/dist/interfaces/itemplate.js.map +1 -0
- package/dist/interfaces/pres-template.d.ts +9 -0
- package/dist/interfaces/pres-template.js +3 -0
- package/dist/interfaces/pres-template.js.map +1 -0
- package/dist/interfaces/root-pres-template.d.ts +38 -0
- package/dist/interfaces/root-pres-template.js +3 -0
- package/dist/interfaces/root-pres-template.js.map +1 -0
- package/dist/modify/modify-chart.d.ts +74 -0
- package/dist/modify/modify-chart.js +753 -0
- package/dist/modify/modify-chart.js.map +1 -0
- package/dist/modify/modify-table.d.ts +64 -0
- package/dist/modify/modify-table.js +435 -0
- package/dist/modify/modify-table.js.map +1 -0
- package/dist/shapes/chart.d.ts +91 -0
- package/dist/shapes/chart.js +437 -0
- package/dist/shapes/chart.js.map +1 -0
- package/dist/shapes/diagram.d.ts +33 -0
- package/dist/shapes/diagram.js +167 -0
- package/dist/shapes/diagram.js.map +1 -0
- package/dist/shapes/generic.d.ts +27 -0
- package/dist/shapes/generic.js +118 -0
- package/dist/shapes/generic.js.map +1 -0
- package/dist/shapes/hyperlink.d.ts +27 -0
- package/dist/shapes/hyperlink.js +193 -0
- package/dist/shapes/hyperlink.js.map +1 -0
- package/dist/shapes/image.d.ts +47 -0
- package/dist/shapes/image.js +244 -0
- package/dist/shapes/image.js.map +1 -0
- package/dist/shapes/ole.d.ts +30 -0
- package/dist/shapes/ole.js +237 -0
- package/dist/shapes/ole.js.map +1 -0
- package/dist/types/chart-types.d.ts +115 -0
- package/dist/types/chart-types.js +3 -0
- package/dist/types/chart-types.js.map +1 -0
- package/dist/types/modify-types.d.ts +128 -0
- package/dist/types/modify-types.js +3 -0
- package/dist/types/modify-types.js.map +1 -0
- package/dist/types/shape-types.d.ts +40 -0
- package/dist/types/shape-types.js +3 -0
- package/dist/types/shape-types.js.map +1 -0
- package/dist/types/table-types.d.ts +38 -0
- package/dist/types/table-types.js +3 -0
- package/dist/types/table-types.js.map +1 -0
- package/dist/types/types.d.ts +317 -0
- package/dist/types/types.js +16 -0
- package/dist/types/types.js.map +1 -0
- package/dist/types/xml-types.d.ts +168 -0
- package/dist/types/xml-types.js +3 -0
- package/dist/types/xml-types.js.map +1 -0
- package/package.json +92 -4
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { XmlElement } from '../types/xml-types';
|
|
2
|
+
import { MultiTextParagraph } from '../interfaces/imulti-text';
|
|
3
|
+
export declare class MultiTextHelper {
|
|
4
|
+
private element;
|
|
5
|
+
private document;
|
|
6
|
+
private relationElement?;
|
|
7
|
+
constructor(element: XmlElement, relationElement?: XmlElement);
|
|
8
|
+
/**
|
|
9
|
+
* Apply multi-text paragraphs to the element
|
|
10
|
+
*/
|
|
11
|
+
run(paragraphs: MultiTextParagraph[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Extract the fallback style from the existing text, so generated runs keep
|
|
14
|
+
* the template's look where the caller says nothing.
|
|
15
|
+
*
|
|
16
|
+
* Restricted to size and color on purpose: bold/italic of the template's
|
|
17
|
+
* first run are a property of *that* text, not of the shape, and inheriting
|
|
18
|
+
* them made every generated run bold as soon as the placeholder was
|
|
19
|
+
* (e.g. a title). Callers who want bold pass it in their TextStyle.
|
|
20
|
+
*/
|
|
21
|
+
private extractDefaultStyle;
|
|
22
|
+
/**
|
|
23
|
+
* Find or create the txBody element and ensure it has required child elements
|
|
24
|
+
*
|
|
25
|
+
* Notes:
|
|
26
|
+
* - Text boxes / shapes use `p:txBody`
|
|
27
|
+
* - Table cells (`a:tc`) use `a:txBody`
|
|
28
|
+
*/
|
|
29
|
+
private getOrCreateTxBody;
|
|
30
|
+
/**
|
|
31
|
+
* Remove all existing paragraph elements
|
|
32
|
+
*/
|
|
33
|
+
private clearExistingParagraphs;
|
|
34
|
+
/**
|
|
35
|
+
* Create paragraph elements for each MultiTextParagraph
|
|
36
|
+
*/
|
|
37
|
+
private createParagraphs;
|
|
38
|
+
/**
|
|
39
|
+
* Merge default style with provided style
|
|
40
|
+
*/
|
|
41
|
+
private mergeStyles;
|
|
42
|
+
/**
|
|
43
|
+
* Apply paragraph styling properties
|
|
44
|
+
*/
|
|
45
|
+
private applyParagraphProperties;
|
|
46
|
+
/**
|
|
47
|
+
* Apply bullet configuration to paragraph properties.
|
|
48
|
+
*
|
|
49
|
+
* PPTX has no list object - a list item is a paragraph with bullet
|
|
50
|
+
* properties, either a literal glyph (`a:buChar`) or automatic numbering
|
|
51
|
+
* (`a:buAutoNum`).
|
|
52
|
+
*/
|
|
53
|
+
private applyBulletConfiguration;
|
|
54
|
+
/**
|
|
55
|
+
* Apply spacing properties to paragraph properties
|
|
56
|
+
*/
|
|
57
|
+
private applySpacingProperties;
|
|
58
|
+
/**
|
|
59
|
+
* Append one spacing element (`a:lnSpc`/`a:spcBef`/`a:spcAft`). A plain
|
|
60
|
+
* number is absolute points (`a:spcPts`, 100ths of a point); `{ percent }`
|
|
61
|
+
* scales with the line height (`a:spcPct`, thousandths of a percent).
|
|
62
|
+
*/
|
|
63
|
+
private appendSpacing;
|
|
64
|
+
/**
|
|
65
|
+
* Create text runs for a paragraph
|
|
66
|
+
*/
|
|
67
|
+
private createTextRuns;
|
|
68
|
+
/**
|
|
69
|
+
* Create a single text run with the given text and style
|
|
70
|
+
*/
|
|
71
|
+
private createSingleTextRun;
|
|
72
|
+
/**
|
|
73
|
+
* Create a regular text run without hyperlink
|
|
74
|
+
*/
|
|
75
|
+
private createRegularTextRun;
|
|
76
|
+
/**
|
|
77
|
+
* Split text at soft line breaks and emit an `<a:br/>` between the segments.
|
|
78
|
+
*
|
|
79
|
+
* PPTX has no in-run line break: a soft break (Shift+Enter) is an `<a:br/>`
|
|
80
|
+
* element sitting *between* two `<a:r>` siblings. PowerPoint itself hands out
|
|
81
|
+
* U+000B (vertical tab) for such a break when text is read back from a shape,
|
|
82
|
+
* so `\v` is treated like `\n` here. A literal `\v` in `<a:t>` is not even
|
|
83
|
+
* valid XML 1.0 and used to produce a file PowerPoint offers to repair.
|
|
84
|
+
*
|
|
85
|
+
* Empty segments (consecutive breaks) do not get a run of their own — only
|
|
86
|
+
* text that was empty to begin with keeps its single empty run.
|
|
87
|
+
*/
|
|
88
|
+
private forEachLine;
|
|
89
|
+
/**
|
|
90
|
+
* Append an `<a:br/>` carrying the surrounding run style, so the empty line
|
|
91
|
+
* keeps the font size (and therefore the line height) of its neighbours.
|
|
92
|
+
*/
|
|
93
|
+
private appendLineBreak;
|
|
94
|
+
/**
|
|
95
|
+
* Apply a TextStyle to an `<a:rPr>`, ignoring the hyperlink part
|
|
96
|
+
* (hyperlinks are an element inside rPr, added by HyperlinkElement)
|
|
97
|
+
*/
|
|
98
|
+
private applyRunStyle;
|
|
99
|
+
/**
|
|
100
|
+
* Create a text element with the given content
|
|
101
|
+
*/
|
|
102
|
+
private createTextElement;
|
|
103
|
+
/**
|
|
104
|
+
* Create a hyperlinked text run using HyperlinkElement
|
|
105
|
+
*/
|
|
106
|
+
private createHyperlinkTextRun;
|
|
107
|
+
/**
|
|
108
|
+
* Create relationship data for hyperlink (reused from ModifyHyperlinkHelper)
|
|
109
|
+
*/
|
|
110
|
+
private createRelationshipData;
|
|
111
|
+
private formatTarget;
|
|
112
|
+
/**
|
|
113
|
+
* Add relationship to the relation element (reused logic from ModifyHyperlinkHelper)
|
|
114
|
+
*/
|
|
115
|
+
private addRelationship;
|
|
116
|
+
}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MultiTextHelper = void 0;
|
|
7
|
+
const modify_text_helper_1 = __importDefault(require("./modify-text-helper"));
|
|
8
|
+
const xml_helper_1 = require("./xml-helper");
|
|
9
|
+
const xml_relationship_helper_1 = require("./xml-relationship-helper");
|
|
10
|
+
const modify_hyperlink_element_1 = __importDefault(require("./modify-hyperlink-element"));
|
|
11
|
+
/**
|
|
12
|
+
* Children of <a:pPr>, in OOXML schema order (CT_TextParagraphProperties).
|
|
13
|
+
* Spacing comes before the bullet properties: appending bullets first is what
|
|
14
|
+
* used to make PowerPoint offer to repair the file.
|
|
15
|
+
*/
|
|
16
|
+
const PPR_CHILD_ORDER = [
|
|
17
|
+
'a:lnSpc',
|
|
18
|
+
'a:spcBef',
|
|
19
|
+
'a:spcAft',
|
|
20
|
+
'a:buClrTx',
|
|
21
|
+
'a:buClr',
|
|
22
|
+
'a:buSzTx',
|
|
23
|
+
'a:buSzPct',
|
|
24
|
+
'a:buSzPts',
|
|
25
|
+
'a:buFontTx',
|
|
26
|
+
'a:buFont',
|
|
27
|
+
'a:buNone',
|
|
28
|
+
'a:buAutoNum',
|
|
29
|
+
'a:buChar',
|
|
30
|
+
'a:tabLst',
|
|
31
|
+
'a:defRPr',
|
|
32
|
+
'a:extLst',
|
|
33
|
+
];
|
|
34
|
+
/** Default bullet indent step, approx. 0.25 inch in EMU. */
|
|
35
|
+
const BULLET_INDENT = 228600;
|
|
36
|
+
/** Typeface carrying the default '•' glyph. */
|
|
37
|
+
const BULLET_FONT = 'Arial';
|
|
38
|
+
class MultiTextHelper {
|
|
39
|
+
constructor(element, relationElement) {
|
|
40
|
+
this.element = element;
|
|
41
|
+
this.document = element.ownerDocument;
|
|
42
|
+
this.relationElement = relationElement;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Apply multi-text paragraphs to the element
|
|
46
|
+
*/
|
|
47
|
+
run(paragraphs) {
|
|
48
|
+
const txBody = this.getOrCreateTxBody();
|
|
49
|
+
const defaultStyle = this.extractDefaultStyle(txBody);
|
|
50
|
+
this.clearExistingParagraphs(txBody);
|
|
51
|
+
this.createParagraphs(txBody, paragraphs, defaultStyle);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Extract the fallback style from the existing text, so generated runs keep
|
|
55
|
+
* the template's look where the caller says nothing.
|
|
56
|
+
*
|
|
57
|
+
* Restricted to size and color on purpose: bold/italic of the template's
|
|
58
|
+
* first run are a property of *that* text, not of the shape, and inheriting
|
|
59
|
+
* them made every generated run bold as soon as the placeholder was
|
|
60
|
+
* (e.g. a title). Callers who want bold pass it in their TextStyle.
|
|
61
|
+
*/
|
|
62
|
+
extractDefaultStyle(txBody) {
|
|
63
|
+
const defaultStyle = {};
|
|
64
|
+
const existingParagraphs = txBody.getElementsByTagName('a:p');
|
|
65
|
+
if (existingParagraphs.length === 0) {
|
|
66
|
+
return defaultStyle;
|
|
67
|
+
}
|
|
68
|
+
// Try to get font size from the first text run
|
|
69
|
+
const firstPara = existingParagraphs[0];
|
|
70
|
+
const firstRun = firstPara.getElementsByTagName('a:r')[0];
|
|
71
|
+
if (firstRun) {
|
|
72
|
+
const rPr = firstRun.getElementsByTagName('a:rPr')[0];
|
|
73
|
+
if (rPr) {
|
|
74
|
+
// Extract font size if it exists
|
|
75
|
+
const fontSize = rPr.getAttribute('sz');
|
|
76
|
+
if (fontSize) {
|
|
77
|
+
defaultStyle.size = parseInt(fontSize);
|
|
78
|
+
}
|
|
79
|
+
// Extract color if it exists
|
|
80
|
+
const solidFill = rPr.getElementsByTagName('a:solidFill')[0];
|
|
81
|
+
if (solidFill) {
|
|
82
|
+
const srgbClr = solidFill.getElementsByTagName('a:srgbClr')[0];
|
|
83
|
+
if (srgbClr) {
|
|
84
|
+
const colorValue = srgbClr.getAttribute('val');
|
|
85
|
+
if (colorValue) {
|
|
86
|
+
defaultStyle.color = {
|
|
87
|
+
type: 'srgbClr',
|
|
88
|
+
value: colorValue,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return defaultStyle;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Find or create the txBody element and ensure it has required child elements
|
|
99
|
+
*
|
|
100
|
+
* Notes:
|
|
101
|
+
* - Text boxes / shapes use `p:txBody`
|
|
102
|
+
* - Table cells (`a:tc`) use `a:txBody`
|
|
103
|
+
*/
|
|
104
|
+
getOrCreateTxBody() {
|
|
105
|
+
// 1) Find existing txBody for both shapes and table cells
|
|
106
|
+
let txBody = this.element.getElementsByTagName('p:txBody')[0] ||
|
|
107
|
+
this.element.getElementsByTagName('a:txBody')[0];
|
|
108
|
+
// 2) If missing, create correct txBody depending on host element
|
|
109
|
+
if (!txBody) {
|
|
110
|
+
const isTableCell = this.element.tagName === 'a:tc';
|
|
111
|
+
// Table cell text lives in DrawingML (`a:*`), shape text in PresentationML (`p:*`)
|
|
112
|
+
txBody = this.document.createElement(isTableCell ? 'a:txBody' : 'p:txBody');
|
|
113
|
+
this.element.appendChild(txBody);
|
|
114
|
+
}
|
|
115
|
+
// 3) Ensure required children exist (always DrawingML children)
|
|
116
|
+
let bodyPr = txBody.getElementsByTagName('a:bodyPr')[0];
|
|
117
|
+
if (!bodyPr) {
|
|
118
|
+
bodyPr = this.document.createElement('a:bodyPr');
|
|
119
|
+
txBody.insertBefore(bodyPr, txBody.firstChild);
|
|
120
|
+
}
|
|
121
|
+
let lstStyle = txBody.getElementsByTagName('a:lstStyle')[0];
|
|
122
|
+
if (!lstStyle) {
|
|
123
|
+
lstStyle = this.document.createElement('a:lstStyle');
|
|
124
|
+
const insertAfter = bodyPr.nextSibling;
|
|
125
|
+
if (insertAfter) {
|
|
126
|
+
txBody.insertBefore(lstStyle, insertAfter);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
txBody.appendChild(lstStyle);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return txBody;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Remove all existing paragraph elements
|
|
136
|
+
*/
|
|
137
|
+
clearExistingParagraphs(txBody) {
|
|
138
|
+
const existingParagraphs = txBody.getElementsByTagName('a:p');
|
|
139
|
+
const length = existingParagraphs.length;
|
|
140
|
+
for (let i = length - 1; i >= 0; i--) {
|
|
141
|
+
const paragraph = existingParagraphs[i];
|
|
142
|
+
paragraph.parentNode.removeChild(paragraph);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Create paragraph elements for each MultiTextParagraph
|
|
147
|
+
*/
|
|
148
|
+
createParagraphs(txBody, paragraphs, defaultStyle = {}) {
|
|
149
|
+
paragraphs.forEach((para) => {
|
|
150
|
+
const p = this.document.createElement('a:p');
|
|
151
|
+
txBody.appendChild(p);
|
|
152
|
+
const pPr = this.document.createElement('a:pPr');
|
|
153
|
+
p.appendChild(pPr);
|
|
154
|
+
if (para.paragraph) {
|
|
155
|
+
this.applyParagraphProperties(pPr, para.paragraph);
|
|
156
|
+
}
|
|
157
|
+
if (para.textRuns && para.textRuns.length > 0) {
|
|
158
|
+
this.createTextRuns(p, para.textRuns, defaultStyle);
|
|
159
|
+
}
|
|
160
|
+
else if (para.text !== undefined) {
|
|
161
|
+
// Merge default style with provided style
|
|
162
|
+
const mergedStyle = this.mergeStyles(defaultStyle, para.style);
|
|
163
|
+
this.createSingleTextRun(p, para.text, mergedStyle);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Merge default style with provided style
|
|
169
|
+
*/
|
|
170
|
+
mergeStyles(defaultStyle = {}, customStyle = {}) {
|
|
171
|
+
return Object.assign(Object.assign({}, defaultStyle), customStyle);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Apply paragraph styling properties
|
|
175
|
+
*/
|
|
176
|
+
applyParagraphProperties(pPr, paragraphProps) {
|
|
177
|
+
var _a;
|
|
178
|
+
const level = (_a = paragraphProps.level) !== null && _a !== void 0 ? _a : 0;
|
|
179
|
+
// Set bullet level
|
|
180
|
+
if (paragraphProps.level !== undefined) {
|
|
181
|
+
pPr.setAttribute('lvl', String(paragraphProps.level));
|
|
182
|
+
}
|
|
183
|
+
// Set bullet configuration
|
|
184
|
+
this.applyBulletConfiguration(pPr, paragraphProps);
|
|
185
|
+
// Set alignment
|
|
186
|
+
if (paragraphProps.alignment !== undefined) {
|
|
187
|
+
pPr.setAttribute('algn', paragraphProps.alignment);
|
|
188
|
+
}
|
|
189
|
+
// Set custom indentation
|
|
190
|
+
if (paragraphProps.indent !== undefined) {
|
|
191
|
+
pPr.setAttribute('indent', String(paragraphProps.indent));
|
|
192
|
+
}
|
|
193
|
+
else if (paragraphProps.bullet) {
|
|
194
|
+
// Hanging indent, so wrapped lines align with the text, not the bullet
|
|
195
|
+
pPr.setAttribute('indent', String(-BULLET_INDENT));
|
|
196
|
+
}
|
|
197
|
+
// Set left margin
|
|
198
|
+
if (paragraphProps.marginLeft !== undefined) {
|
|
199
|
+
pPr.setAttribute('marL', String(paragraphProps.marginLeft));
|
|
200
|
+
}
|
|
201
|
+
else if (paragraphProps.bullet) {
|
|
202
|
+
// Indent per level: a constant margin renders every nested bullet at the
|
|
203
|
+
// same x-position unless the target layout happens to define a lstStyle
|
|
204
|
+
pPr.setAttribute('marL', String((level + 1) * BULLET_INDENT));
|
|
205
|
+
}
|
|
206
|
+
// Apply spacing properties
|
|
207
|
+
this.applySpacingProperties(pPr, paragraphProps);
|
|
208
|
+
// The steps above append in call order; the schema wants a fixed sequence
|
|
209
|
+
xml_helper_1.XmlHelper.sortChildrenBySchema(pPr, PPR_CHILD_ORDER);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Apply bullet configuration to paragraph properties.
|
|
213
|
+
*
|
|
214
|
+
* PPTX has no list object - a list item is a paragraph with bullet
|
|
215
|
+
* properties, either a literal glyph (`a:buChar`) or automatic numbering
|
|
216
|
+
* (`a:buAutoNum`).
|
|
217
|
+
*/
|
|
218
|
+
applyBulletConfiguration(pPr, paragraphProps) {
|
|
219
|
+
if (paragraphProps.bullet) {
|
|
220
|
+
if (paragraphProps.bulletType === 'number') {
|
|
221
|
+
const buAutoNum = this.document.createElement('a:buAutoNum');
|
|
222
|
+
buAutoNum.setAttribute('type', paragraphProps.autoNumberType || 'arabicPeriod');
|
|
223
|
+
pPr.appendChild(buAutoNum);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
// A glyph bullet needs the typeface that actually carries the glyph
|
|
227
|
+
const buFont = this.document.createElement('a:buFont');
|
|
228
|
+
buFont.setAttribute('typeface', BULLET_FONT);
|
|
229
|
+
pPr.appendChild(buFont);
|
|
230
|
+
const buChar = this.document.createElement('a:buChar');
|
|
231
|
+
buChar.setAttribute('char', paragraphProps.bulletChar || '•');
|
|
232
|
+
pPr.appendChild(buChar);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (paragraphProps.bullet === false || paragraphProps.level === 0) {
|
|
236
|
+
// Suppress a bullet the layout's lstStyle would otherwise inherit
|
|
237
|
+
const buNone = this.document.createElement('a:buNone');
|
|
238
|
+
pPr.appendChild(buNone);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Apply spacing properties to paragraph properties
|
|
243
|
+
*/
|
|
244
|
+
applySpacingProperties(pPr, paragraphProps) {
|
|
245
|
+
this.appendSpacing(pPr, 'a:lnSpc', paragraphProps.lineSpacing);
|
|
246
|
+
this.appendSpacing(pPr, 'a:spcBef', paragraphProps.spaceBefore);
|
|
247
|
+
this.appendSpacing(pPr, 'a:spcAft', paragraphProps.spaceAfter);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Append one spacing element (`a:lnSpc`/`a:spcBef`/`a:spcAft`). A plain
|
|
251
|
+
* number is absolute points (`a:spcPts`, 100ths of a point); `{ percent }`
|
|
252
|
+
* scales with the line height (`a:spcPct`, thousandths of a percent).
|
|
253
|
+
*/
|
|
254
|
+
appendSpacing(pPr, tagName, spacing) {
|
|
255
|
+
if (spacing === undefined) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const wrapper = this.document.createElement(tagName);
|
|
259
|
+
if (typeof spacing === 'number') {
|
|
260
|
+
const spcPts = this.document.createElement('a:spcPts');
|
|
261
|
+
spcPts.setAttribute('val', String(Math.round(spacing * 100)));
|
|
262
|
+
wrapper.appendChild(spcPts);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const spcPct = this.document.createElement('a:spcPct');
|
|
266
|
+
spcPct.setAttribute('val', String(Math.round(spacing.percent * 1000)));
|
|
267
|
+
wrapper.appendChild(spcPct);
|
|
268
|
+
}
|
|
269
|
+
pPr.appendChild(wrapper);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Create text runs for a paragraph
|
|
273
|
+
*/
|
|
274
|
+
createTextRuns(p, textRuns, defaultStyle = {}) {
|
|
275
|
+
textRuns.forEach((run) => {
|
|
276
|
+
const mergedStyle = this.mergeStyles(defaultStyle, run.style);
|
|
277
|
+
// An explicit break is an element between runs, not a run with text
|
|
278
|
+
if (run.break) {
|
|
279
|
+
this.appendLineBreak(p, mergedStyle);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
// Check if this text run needs a hyperlink
|
|
283
|
+
if ((mergedStyle === null || mergedStyle === void 0 ? void 0 : mergedStyle.hyperlink) && this.relationElement) {
|
|
284
|
+
this.createHyperlinkTextRun(p, run.text || '', mergedStyle);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
this.createRegularTextRun(p, run.text || '', mergedStyle);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Create a single text run with the given text and style
|
|
293
|
+
*/
|
|
294
|
+
createSingleTextRun(p, text, style) {
|
|
295
|
+
const textString = String(text || '');
|
|
296
|
+
// Check if this text run needs a hyperlink
|
|
297
|
+
if ((style === null || style === void 0 ? void 0 : style.hyperlink) && this.relationElement) {
|
|
298
|
+
this.createHyperlinkTextRun(p, textString, style);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this.createRegularTextRun(p, textString, style);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Create a regular text run without hyperlink
|
|
306
|
+
*/
|
|
307
|
+
createRegularTextRun(p, text, style) {
|
|
308
|
+
this.forEachLine(p, text, style, (line) => {
|
|
309
|
+
const r = this.document.createElement('a:r');
|
|
310
|
+
p.appendChild(r);
|
|
311
|
+
const rPr = this.document.createElement('a:rPr');
|
|
312
|
+
r.appendChild(rPr);
|
|
313
|
+
// Apply text styling (excluding hyperlink)
|
|
314
|
+
this.applyRunStyle(rPr, style);
|
|
315
|
+
this.createTextElement(r, line);
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Split text at soft line breaks and emit an `<a:br/>` between the segments.
|
|
320
|
+
*
|
|
321
|
+
* PPTX has no in-run line break: a soft break (Shift+Enter) is an `<a:br/>`
|
|
322
|
+
* element sitting *between* two `<a:r>` siblings. PowerPoint itself hands out
|
|
323
|
+
* U+000B (vertical tab) for such a break when text is read back from a shape,
|
|
324
|
+
* so `\v` is treated like `\n` here. A literal `\v` in `<a:t>` is not even
|
|
325
|
+
* valid XML 1.0 and used to produce a file PowerPoint offers to repair.
|
|
326
|
+
*
|
|
327
|
+
* Empty segments (consecutive breaks) do not get a run of their own — only
|
|
328
|
+
* text that was empty to begin with keeps its single empty run.
|
|
329
|
+
*/
|
|
330
|
+
forEachLine(p, text, style, createRun) {
|
|
331
|
+
// eslint-disable-next-line no-control-regex -- U+000B is one of the breaks we split on
|
|
332
|
+
const lines = String(text !== null && text !== void 0 ? text : '').split(/\r\n|[\r\n\u000B]/);
|
|
333
|
+
lines.forEach((line, index) => {
|
|
334
|
+
if (index > 0) {
|
|
335
|
+
this.appendLineBreak(p, style);
|
|
336
|
+
}
|
|
337
|
+
// Consecutive breaks: the break alone is the empty line
|
|
338
|
+
if (line === '' && lines.length > 1) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
createRun(line);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Append an `<a:br/>` carrying the surrounding run style, so the empty line
|
|
346
|
+
* keeps the font size (and therefore the line height) of its neighbours.
|
|
347
|
+
*/
|
|
348
|
+
appendLineBreak(p, style) {
|
|
349
|
+
const br = this.document.createElement('a:br');
|
|
350
|
+
const rPr = this.document.createElement('a:rPr');
|
|
351
|
+
br.appendChild(rPr);
|
|
352
|
+
this.applyRunStyle(rPr, style);
|
|
353
|
+
p.appendChild(br);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Apply a TextStyle to an `<a:rPr>`, ignoring the hyperlink part
|
|
357
|
+
* (hyperlinks are an element inside rPr, added by HyperlinkElement)
|
|
358
|
+
*/
|
|
359
|
+
applyRunStyle(rPr, style) {
|
|
360
|
+
if (!style)
|
|
361
|
+
return;
|
|
362
|
+
const styleWithoutHyperlink = Object.assign({}, style);
|
|
363
|
+
delete styleWithoutHyperlink.hyperlink;
|
|
364
|
+
modify_text_helper_1.default.style(styleWithoutHyperlink)(rPr);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Create a text element with the given content
|
|
368
|
+
*/
|
|
369
|
+
createTextElement(r, text) {
|
|
370
|
+
const t = this.document.createElement('a:t');
|
|
371
|
+
r.appendChild(t);
|
|
372
|
+
// Handle empty strings with xml:space="preserve"
|
|
373
|
+
if (text === '') {
|
|
374
|
+
t.setAttribute('xml:space', 'preserve');
|
|
375
|
+
}
|
|
376
|
+
// Set text content
|
|
377
|
+
const sanitized = xml_helper_1.XmlHelper.sanitizeText(text);
|
|
378
|
+
const textNode = this.document.createTextNode(sanitized);
|
|
379
|
+
t.appendChild(textNode);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Create a hyperlinked text run using HyperlinkElement
|
|
383
|
+
*/
|
|
384
|
+
createHyperlinkTextRun(p, text, style) {
|
|
385
|
+
if (!style.hyperlink || !this.relationElement) {
|
|
386
|
+
// Fallback to regular text run if no hyperlink info or relation element
|
|
387
|
+
this.createRegularTextRun(p, text, style);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const hyperlinkInfo = style.hyperlink;
|
|
391
|
+
const target = hyperlinkInfo.target;
|
|
392
|
+
const isInternal = hyperlinkInfo.isInternal;
|
|
393
|
+
if (!target) {
|
|
394
|
+
this.createRegularTextRun(p, text, style);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
// Create relationship data for the hyperlink
|
|
398
|
+
const relData = this.createRelationshipData(target, isInternal || false);
|
|
399
|
+
const newRelId = this.addRelationship(this.relationElement, relData);
|
|
400
|
+
// Create HyperlinkElement to generate the hyperlinked text run
|
|
401
|
+
const hyperlinkElement = new modify_hyperlink_element_1.default(this.document, newRelId, isInternal || false);
|
|
402
|
+
// Create the text run(s) with hyperlink; a soft line break splits the text
|
|
403
|
+
// into several runs, all pointing at the same relationship
|
|
404
|
+
this.forEachLine(p, text, style, (line) => {
|
|
405
|
+
const r = hyperlinkElement.createTextRun(line);
|
|
406
|
+
// Apply additional styling if needed (excluding hyperlink)
|
|
407
|
+
const rPr = r.getElementsByTagName('a:rPr')[0];
|
|
408
|
+
if (rPr) {
|
|
409
|
+
this.applyRunStyle(rPr, style);
|
|
410
|
+
}
|
|
411
|
+
p.appendChild(r);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Create relationship data for hyperlink (reused from ModifyHyperlinkHelper)
|
|
416
|
+
*/
|
|
417
|
+
createRelationshipData(target, isInternal) {
|
|
418
|
+
if (isInternal) {
|
|
419
|
+
return {
|
|
420
|
+
Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide',
|
|
421
|
+
Target: `../slides/${this.formatTarget(target)}`,
|
|
422
|
+
Id: '', // Will be set later
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
Type: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
|
427
|
+
Target: target.toString(),
|
|
428
|
+
TargetMode: 'External',
|
|
429
|
+
Id: '', // Will be set later
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
formatTarget(target) {
|
|
433
|
+
// For internal links, ensure the target is properly formatted
|
|
434
|
+
let formattedTarget = target;
|
|
435
|
+
if (typeof target === 'number') {
|
|
436
|
+
formattedTarget = `slide${target}.xml`;
|
|
437
|
+
}
|
|
438
|
+
else if (typeof target === 'string' && !target.includes('.xml')) {
|
|
439
|
+
// If it's a string but doesn't end with .xml, assume it's a slide number
|
|
440
|
+
formattedTarget = `slide${target}.xml`;
|
|
441
|
+
}
|
|
442
|
+
return formattedTarget;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Add relationship to the relation element (reused logic from ModifyHyperlinkHelper)
|
|
446
|
+
*/
|
|
447
|
+
addRelationship(relation, relData) {
|
|
448
|
+
const relNodes = relation.getElementsByTagName('Relationship');
|
|
449
|
+
const maxId = xml_relationship_helper_1.XmlRelationshipHelper.getMaxId(relNodes, 'Id', true);
|
|
450
|
+
const newRelId = `rId${maxId}`;
|
|
451
|
+
const newRel = relation.ownerDocument.createElement('Relationship');
|
|
452
|
+
newRel.setAttribute('Id', newRelId);
|
|
453
|
+
Object.entries(relData).forEach(([key, value]) => {
|
|
454
|
+
if (value)
|
|
455
|
+
newRel.setAttribute(key, value);
|
|
456
|
+
});
|
|
457
|
+
relNodes.item(0).parentNode.appendChild(newRel);
|
|
458
|
+
return newRelId;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
exports.MultiTextHelper = MultiTextHelper;
|
|
462
|
+
//# sourceMappingURL=multitext-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multitext-helper.js","sourceRoot":"","sources":["../../src/helper/multitext-helper.ts"],"names":[],"mappings":";;;;;;AAOA,8EAAoD;AACpD,6CAAyC;AACzC,uEAAkE;AAClE,0FAA0D;AAI1D;;;;GAIG;AACH,MAAM,eAAe,GAAG;IACtB,SAAS;IACT,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;IACX,YAAY;IACZ,UAAU;IACV,UAAU;IACV,aAAa;IACb,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC;AAEF,4DAA4D;AAC5D,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,+CAA+C;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,MAAa,eAAe;IAK1B,YAAY,OAAmB,EAAE,eAA4B;QAC3D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,eAAe,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7
|
+
* Central builder for all part paths inside a .pptx archive.
|
|
8
|
+
*
|
|
9
|
+
* OOXML paths follow strict conventions (`ppt/slides/slide<n>.xml`,
|
|
10
|
+
* `ppt/slides/_rels/slide<n>.xml.rels`, …). Build them here instead of
|
|
11
|
+
* inlining template strings — one typo-prone convention, one place.
|
|
12
|
+
*
|
|
13
|
+
* Numbering is 1-based and file-name-driven throughout.
|
|
14
|
+
*/
|
|
15
|
+
export declare class PptPaths {
|
|
16
|
+
static readonly presentation = "ppt/presentation.xml";
|
|
17
|
+
static readonly presentationRels = "ppt/_rels/presentation.xml.rels";
|
|
18
|
+
static readonly contentTypes = "[Content_Types].xml";
|
|
19
|
+
static readonly mediaDir = "ppt/media";
|
|
20
|
+
static readonly drawingsDir = "ppt/drawings";
|
|
21
|
+
/**
|
|
22
|
+
* Generic numbered part: `ppt/<prefix>s/<prefix><n>.xml`.
|
|
23
|
+
* Covers slide, slideMaster, slideLayout and notesSlide.
|
|
24
|
+
*/
|
|
25
|
+
static part(prefix: NumberedPartPrefix, n: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Relationships file of a numbered part:
|
|
28
|
+
* `ppt/<prefix>s/_rels/<prefix><n>.xml.rels`.
|
|
29
|
+
*/
|
|
30
|
+
static partRels(prefix: NumberedPartPrefix, n: number): string;
|
|
31
|
+
static slide(n: number): string;
|
|
32
|
+
static slideRels(n: number): string;
|
|
33
|
+
static slideMaster(n: number): string;
|
|
34
|
+
static slideMasterRels(n: number): string;
|
|
35
|
+
static slideLayout(n: number): string;
|
|
36
|
+
static slideLayoutRels(n: number): string;
|
|
37
|
+
static notesSlide(n: number): string;
|
|
38
|
+
static notesSlideRels(n: number): string;
|
|
39
|
+
static theme(n: number | string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Numbered part in `ppt/charts/`: pass 'chart', 'chartEx', 'style'
|
|
42
|
+
* or 'colors' as name.
|
|
43
|
+
*/
|
|
44
|
+
static chartPart(name: string, n: number): string;
|
|
45
|
+
static chartPartRels(name: string, n: number): string;
|
|
46
|
+
static media(filename: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Chart user shapes drawing (`chartUserShapes` relationship of a chart).
|
|
49
|
+
*/
|
|
50
|
+
static drawing(n: number | string): string;
|
|
51
|
+
static drawingRels(n: number | string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Relationships file of any part: `<dir>/_rels/<file>.rels`.
|
|
54
|
+
* For parts whose name is taken from a source archive rather than built
|
|
55
|
+
* from a number (e.g. a chart's user shapes drawing).
|
|
56
|
+
*/
|
|
57
|
+
static relsOf(partPath: string): string;
|
|
58
|
+
static embedding(filename: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* `[Content_Types].xml` PartName attributes require a leading slash.
|
|
61
|
+
*/
|
|
62
|
+
static partName(path: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Relative targets as used inside `_rels` files
|
|
65
|
+
* (relative to the referencing part's directory).
|
|
66
|
+
*/
|
|
67
|
+
static relative: {
|
|
68
|
+
slide: (n: number) => string;
|
|
69
|
+
notesSlide: (n: number) => string;
|
|
70
|
+
slideLayout: (n: number) => string;
|
|
71
|
+
slideMaster: (n: number) => string;
|
|
72
|
+
theme: (n: number | string) => string;
|
|
73
|
+
drawing: (n: number | string) => string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export {};
|