@json-to-office/core-docx 4.4.0 → 4.4.1
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.
|
@@ -3265,6 +3265,7 @@ import {
|
|
|
3265
3265
|
Header,
|
|
3266
3266
|
ImageRun,
|
|
3267
3267
|
Packer,
|
|
3268
|
+
LineRuleType as LineRuleType2,
|
|
3268
3269
|
Paragraph as Paragraph2
|
|
3269
3270
|
} from "docx";
|
|
3270
3271
|
function createDocxJsRenderer() {
|
|
@@ -3518,21 +3519,33 @@ function sectionChildren(section2, resources) {
|
|
|
3518
3519
|
const blocks = section2.children.map((block2) => emitBlock(block2, resources));
|
|
3519
3520
|
const bookmark = section2.bookmark;
|
|
3520
3521
|
if (!bookmark) return blocks;
|
|
3521
|
-
const out = [];
|
|
3522
|
+
const out = [...blocks];
|
|
3522
3523
|
if (bookmark.opens) {
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3524
|
+
const start = new BookmarkStart2(bookmark.name, bookmark.id);
|
|
3525
|
+
const first = out[0];
|
|
3526
|
+
if (first instanceof Paragraph2) {
|
|
3527
|
+
first.addRunToFront(start);
|
|
3528
|
+
} else {
|
|
3529
|
+
out.unshift(anchorParagraph(start));
|
|
3530
|
+
}
|
|
3529
3531
|
}
|
|
3530
|
-
out.push(...blocks);
|
|
3531
3532
|
if (bookmark.closes) {
|
|
3532
|
-
|
|
3533
|
+
const end = new BookmarkEnd2(bookmark.id);
|
|
3534
|
+
const last = out[out.length - 1];
|
|
3535
|
+
if (last instanceof Paragraph2) {
|
|
3536
|
+
last.addChildElement(end);
|
|
3537
|
+
} else {
|
|
3538
|
+
out.push(anchorParagraph(end));
|
|
3539
|
+
}
|
|
3533
3540
|
}
|
|
3534
3541
|
return out;
|
|
3535
3542
|
}
|
|
3543
|
+
function anchorParagraph(anchor) {
|
|
3544
|
+
return new Paragraph2({
|
|
3545
|
+
children: [anchor],
|
|
3546
|
+
spacing: { before: 0, after: 0, line: 20, lineRule: LineRuleType2.EXACT }
|
|
3547
|
+
});
|
|
3548
|
+
}
|
|
3536
3549
|
function coreProperties(ir) {
|
|
3537
3550
|
const { metadata } = ir;
|
|
3538
3551
|
return {
|