Merge pull request #1861 from dolanmiu/hot-fix/return-constructor-value

Hot fix/return constructor value
This commit is contained in:
Dolan
2022-12-30 16:40:35 +00:00
committed by GitHub
3 changed files with 5 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "docx", "name": "docx",
"version": "7.8.0", "version": "7.8.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "docx", "name": "docx",
"version": "7.8.0", "version": "7.8.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@types/node": "^18.0.0", "@types/node": "^18.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "docx", "name": "docx",
"version": "7.8.0", "version": "7.8.1",
"description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.",
"main": "build/index.js", "main": "build/index.js",
"scripts": { "scripts": {

View File

@ -23,11 +23,11 @@ export class Text extends XmlComponent {
if (typeof options === "string") { if (typeof options === "string") {
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push(options); this.root.push(options);
return; return this;
} else { } else {
this.root.push(new TextAttributes({ space: options.space ?? SpaceType.DEFAULT })); this.root.push(new TextAttributes({ space: options.space ?? SpaceType.DEFAULT }));
this.root.push(options.text); this.root.push(options.text);
return; return this;
} }
} }
} }