docxmlater 10.2.8 → 10.3.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/dist/core/DocumentParser.d.ts.map +1 -1
- package/dist/core/DocumentParser.js +1 -0
- package/dist/core/DocumentParser.js.map +1 -1
- package/dist/elements/ImageRun.d.ts +3 -0
- package/dist/elements/ImageRun.d.ts.map +1 -1
- package/dist/elements/ImageRun.js +10 -0
- package/dist/elements/ImageRun.js.map +1 -1
- package/package.json +1 -1
- package/src/core/DocumentParser.ts +1 -0
- package/src/elements/ImageRun.ts +12 -0
|
@@ -3,7 +3,10 @@ import { Image } from './Image';
|
|
|
3
3
|
import { XMLElement } from '../xml/XMLBuilder';
|
|
4
4
|
export declare class ImageRun extends Run {
|
|
5
5
|
private imageElement;
|
|
6
|
+
private _rawRunXml?;
|
|
6
7
|
constructor(image: Image);
|
|
8
|
+
setRawRunXml(xml: string): void;
|
|
9
|
+
getRawRunXml(): string | undefined;
|
|
7
10
|
getImageElement(): Image;
|
|
8
11
|
toXML(): XMLElement;
|
|
9
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageRun.d.ts","sourceRoot":"","sources":["../../src/elements/ImageRun.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/C,qBAAa,QAAS,SAAQ,GAAG;IAC/B,OAAO,CAAC,YAAY,CAAQ;gBAMhB,KAAK,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"ImageRun.d.ts","sourceRoot":"","sources":["../../src/elements/ImageRun.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/C,qBAAa,QAAS,SAAQ,GAAG;IAC/B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAC,CAAS;gBAMhB,KAAK,EAAE,KAAK;IAOxB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI/B,YAAY,IAAI,MAAM,GAAG,SAAS;IAQlC,eAAe,IAAI,KAAK;IASxB,KAAK,IAAI,UAAU;CAUpB"}
|
|
@@ -4,14 +4,24 @@ exports.ImageRun = void 0;
|
|
|
4
4
|
const Run_1 = require("./Run");
|
|
5
5
|
class ImageRun extends Run_1.Run {
|
|
6
6
|
imageElement;
|
|
7
|
+
_rawRunXml;
|
|
7
8
|
constructor(image) {
|
|
8
9
|
super('');
|
|
9
10
|
this.imageElement = image;
|
|
10
11
|
}
|
|
12
|
+
setRawRunXml(xml) {
|
|
13
|
+
this._rawRunXml = xml;
|
|
14
|
+
}
|
|
15
|
+
getRawRunXml() {
|
|
16
|
+
return this._rawRunXml;
|
|
17
|
+
}
|
|
11
18
|
getImageElement() {
|
|
12
19
|
return this.imageElement;
|
|
13
20
|
}
|
|
14
21
|
toXML() {
|
|
22
|
+
if (this._rawRunXml) {
|
|
23
|
+
return { name: '__rawXml', rawXml: this._rawRunXml };
|
|
24
|
+
}
|
|
15
25
|
const drawing = this.imageElement.toXML();
|
|
16
26
|
return {
|
|
17
27
|
name: 'w:r',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageRun.js","sourceRoot":"","sources":["../../src/elements/ImageRun.ts"],"names":[],"mappings":";;;AAQA,+BAA4B;AAgB5B,MAAa,QAAS,SAAQ,SAAG;IACvB,YAAY,CAAQ;IAM5B,YAAY,KAAY;QAGtB,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAMD,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAOD,KAAK;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB,CAAC;IACJ,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"ImageRun.js","sourceRoot":"","sources":["../../src/elements/ImageRun.ts"],"names":[],"mappings":";;;AAQA,+BAA4B;AAgB5B,MAAa,QAAS,SAAQ,SAAG;IACvB,YAAY,CAAQ;IACpB,UAAU,CAAU;IAM5B,YAAY,KAAY;QAGtB,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;IACxB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAMD,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAOD,KAAK;QACH,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACvD,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB,CAAC;IACJ,CAAC;CACF;AA9CD,4BA8CC","sourcesContent":["/**\n * ImageRun - A run that contains an image (drawing)\n * Extends Run class for type-safe paragraph content\n *\n * This is a specialized Run that contains a drawing instead of text.\n * It generates proper w:r (run) XML with w:drawing child element.\n */\n\nimport { Run } from './Run';\nimport { Image } from './Image';\nimport { XMLElement } from '../xml/XMLBuilder';\n\n/**\n * ImageRun - A run containing an embedded image\n *\n * In WordprocessingML, images are embedded in runs as drawing elements:\n * <w:r>\n * <w:drawing>\n * <wp:inline>\n * ... image data ...\n * </wp:inline>\n * </w:drawing>\n * </w:r>\n */\nexport class ImageRun extends Run {\n private imageElement: Image;\n private _rawRunXml?: string;\n\n /**\n * Creates a new image run\n * @param image The image to embed in this run\n */\n constructor(image: Image) {\n // Call parent constructor with empty text\n // The text is irrelevant for image runs\n super('');\n this.imageElement = image;\n }\n\n setRawRunXml(xml: string): void {\n this._rawRunXml = xml;\n }\n\n getRawRunXml(): string | undefined {\n return this._rawRunXml;\n }\n\n /**\n * Gets the image element\n * @returns Image instance\n */\n getImageElement(): Image {\n return this.imageElement;\n }\n\n /**\n * Override toXML to generate image-specific XML\n * Generates a w:r element containing w:drawing instead of w:t\n * @returns XMLElement with w:r containing w:drawing\n */\n toXML(): XMLElement {\n if (this._rawRunXml) {\n return { name: '__rawXml', rawXml: this._rawRunXml };\n }\n const drawing = this.imageElement.toXML();\n return {\n name: 'w:r',\n children: [drawing],\n };\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/elements/ImageRun.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { XMLElement } from '../xml/XMLBuilder';
|
|
|
24
24
|
*/
|
|
25
25
|
export class ImageRun extends Run {
|
|
26
26
|
private imageElement: Image;
|
|
27
|
+
private _rawRunXml?: string;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Creates a new image run
|
|
@@ -36,6 +37,14 @@ export class ImageRun extends Run {
|
|
|
36
37
|
this.imageElement = image;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
setRawRunXml(xml: string): void {
|
|
41
|
+
this._rawRunXml = xml;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getRawRunXml(): string | undefined {
|
|
45
|
+
return this._rawRunXml;
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
49
|
* Gets the image element
|
|
41
50
|
* @returns Image instance
|
|
@@ -50,6 +59,9 @@ export class ImageRun extends Run {
|
|
|
50
59
|
* @returns XMLElement with w:r containing w:drawing
|
|
51
60
|
*/
|
|
52
61
|
toXML(): XMLElement {
|
|
62
|
+
if (this._rawRunXml) {
|
|
63
|
+
return { name: '__rawXml', rawXml: this._rawRunXml };
|
|
64
|
+
}
|
|
53
65
|
const drawing = this.imageElement.toXML();
|
|
54
66
|
return {
|
|
55
67
|
name: 'w:r',
|