js.documents 14.4.15 → 14.4.17

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.
@@ -62,7 +62,6 @@ function splitTextToWidth(text, font, sizePt, measurer, maxWidthPt) {
62
62
  width += charWidth;
63
63
  splitIndex = i + 1;
64
64
  }
65
- if (splitIndex === 0 && chars.length > 0) splitIndex = 1;
66
65
  return {
67
66
  fitText: chars.slice(0, splitIndex).join(""),
68
67
  restText: chars.slice(splitIndex).join("")
@@ -61,7 +61,6 @@ function splitTextToWidth(text, font, sizePt, measurer, maxWidthPt) {
61
61
  width += charWidth;
62
62
  splitIndex = i + 1;
63
63
  }
64
- if (splitIndex === 0 && chars.length > 0) splitIndex = 1;
65
64
  return {
66
65
  fitText: chars.slice(0, splitIndex).join(""),
67
66
  restText: chars.slice(splitIndex).join("")
@@ -19,33 +19,31 @@ function readOdtContent(pkg) {
19
19
  const { placements: formulaPlacements, consumedBlockIndices: formulaConsumed } = collectFormulaPlacements(text.children, pkg);
20
20
  const { placements: vectorPlacements, consumedBlockIndices: vectorConsumed } = collectVectorPlacements(text.children, pkg);
21
21
  const { placements: imagePlacements } = collectImagePlacements(text.children, pkg);
22
- if (formulaPlacements.length > 0 || vectorPlacements.length > 0 || imagePlacements.length > 0) {
23
- const combined = [
24
- ...formulaPlacements.map((placement) => ({
25
- index: placement.index,
26
- build: (sourcePath) => require_model_formula.buildFormulaBlock(placement.detected.formula, placement.detected.frame, sourcePath)
27
- })),
28
- ...vectorPlacements.map((placement) => ({
29
- index: placement.index,
30
- build: (sourcePath) => ({
31
- ...require_model_embedded_drawing.buildDrawingBlock(section.pageSize, placement.vectors),
32
- sourcePath
33
- })
34
- })),
35
- ...imagePlacements.map((placement) => ({
36
- index: placement.index,
37
- build: (sourcePath) => ({
38
- ...placement.detected.image,
39
- sourcePath
40
- })
41
- }))
42
- ].sort((a, b) => a.index - b.index);
43
- const consumedBlockIndices = /* @__PURE__ */ new Set([...formulaConsumed, ...vectorConsumed]);
44
- odtDoc.sections[0] = {
45
- ...section,
46
- blocks: require_model_block_splice.spliceBlocks(section.blocks, combined, consumedBlockIndices, (position) => `sections[0].blocks[${position}]`)
47
- };
48
- }
22
+ const combined = [
23
+ ...formulaPlacements.map((placement) => ({
24
+ index: placement.index,
25
+ build: (sourcePath) => require_model_formula.buildFormulaBlock(placement.detected.formula, placement.detected.frame, sourcePath)
26
+ })),
27
+ ...vectorPlacements.map((placement) => ({
28
+ index: placement.index,
29
+ build: (sourcePath) => ({
30
+ ...require_model_embedded_drawing.buildDrawingBlock(section.pageSize, placement.vectors),
31
+ sourcePath
32
+ })
33
+ })),
34
+ ...imagePlacements.map((placement) => ({
35
+ index: placement.index,
36
+ build: (sourcePath) => ({
37
+ ...placement.detected.image,
38
+ sourcePath
39
+ })
40
+ }))
41
+ ].sort((a, b) => a.index - b.index);
42
+ const consumedBlockIndices = /* @__PURE__ */ new Set([...formulaConsumed, ...vectorConsumed]);
43
+ odtDoc.sections[0] = {
44
+ ...section,
45
+ blocks: require_model_block_splice.spliceBlocks(section.blocks, combined, consumedBlockIndices, (position) => `sections[0].blocks[${position}]`)
46
+ };
49
47
  }
50
48
  }
51
49
  return {
@@ -18,33 +18,31 @@ function readOdtContent(pkg) {
18
18
  const { placements: formulaPlacements, consumedBlockIndices: formulaConsumed } = collectFormulaPlacements(text.children, pkg);
19
19
  const { placements: vectorPlacements, consumedBlockIndices: vectorConsumed } = collectVectorPlacements(text.children, pkg);
20
20
  const { placements: imagePlacements } = collectImagePlacements(text.children, pkg);
21
- if (formulaPlacements.length > 0 || vectorPlacements.length > 0 || imagePlacements.length > 0) {
22
- const combined = [
23
- ...formulaPlacements.map((placement) => ({
24
- index: placement.index,
25
- build: (sourcePath) => buildFormulaBlock(placement.detected.formula, placement.detected.frame, sourcePath)
26
- })),
27
- ...vectorPlacements.map((placement) => ({
28
- index: placement.index,
29
- build: (sourcePath) => ({
30
- ...buildDrawingBlock(section.pageSize, placement.vectors),
31
- sourcePath
32
- })
33
- })),
34
- ...imagePlacements.map((placement) => ({
35
- index: placement.index,
36
- build: (sourcePath) => ({
37
- ...placement.detected.image,
38
- sourcePath
39
- })
40
- }))
41
- ].sort((a, b) => a.index - b.index);
42
- const consumedBlockIndices = /* @__PURE__ */ new Set([...formulaConsumed, ...vectorConsumed]);
43
- odtDoc.sections[0] = {
44
- ...section,
45
- blocks: spliceBlocks(section.blocks, combined, consumedBlockIndices, (position) => `sections[0].blocks[${position}]`)
46
- };
47
- }
21
+ const combined = [
22
+ ...formulaPlacements.map((placement) => ({
23
+ index: placement.index,
24
+ build: (sourcePath) => buildFormulaBlock(placement.detected.formula, placement.detected.frame, sourcePath)
25
+ })),
26
+ ...vectorPlacements.map((placement) => ({
27
+ index: placement.index,
28
+ build: (sourcePath) => ({
29
+ ...buildDrawingBlock(section.pageSize, placement.vectors),
30
+ sourcePath
31
+ })
32
+ })),
33
+ ...imagePlacements.map((placement) => ({
34
+ index: placement.index,
35
+ build: (sourcePath) => ({
36
+ ...placement.detected.image,
37
+ sourcePath
38
+ })
39
+ }))
40
+ ].sort((a, b) => a.index - b.index);
41
+ const consumedBlockIndices = /* @__PURE__ */ new Set([...formulaConsumed, ...vectorConsumed]);
42
+ odtDoc.sections[0] = {
43
+ ...section,
44
+ blocks: spliceBlocks(section.blocks, combined, consumedBlockIndices, (position) => `sections[0].blocks[${position}]`)
45
+ };
48
46
  }
49
47
  }
50
48
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "14.4.15",
3
+ "version": "14.4.17",
4
4
  "description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -77,21 +77,21 @@
77
77
  ],
78
78
  "license": "MIT",
79
79
  "dependencies": {
80
- "archive-codec": "1.11.14",
80
+ "archive-codec": "1.11.15",
81
81
  "byte-codec": "2.0.0",
82
- "doc-codec": "6.1.5",
82
+ "doc-codec": "6.1.6",
83
83
  "document-schema.js": "7.15.0",
84
84
  "epub-codec": "5.1.4",
85
85
  "fflate": "0.8.3",
86
86
  "markdown-codec": "11.1.4",
87
87
  "odf.js": "11.1.4",
88
- "ooxml.js": "12.2.10",
88
+ "ooxml.js": "12.2.11",
89
89
  "pdf-codec": "5.2.21",
90
- "ppt-codec": "2.2.5",
91
- "rtf-codec": "8.1.5",
90
+ "ppt-codec": "2.2.6",
91
+ "rtf-codec": "8.1.6",
92
92
  "temml": "0.13.4",
93
- "wpd-codec": "5.1.7",
94
- "xls-codec": "4.15.24",
93
+ "wpd-codec": "5.1.8",
94
+ "xls-codec": "4.15.25",
95
95
  "zod": "4.4.3"
96
96
  },
97
97
  "devDependencies": {