docxmlater 10.3.1 → 10.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docxmlater",
3
- "version": "10.3.1",
3
+ "version": "10.3.3",
4
4
  "description": "A comprehensive DOCX editing framework for creating, reading, and manipulating Microsoft Word documents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2766,6 +2766,7 @@ export class DocumentParser {
2766
2766
  // We need to reconstruct the original order based on field state transitions
2767
2767
  let hasSep = false;
2768
2768
  for (const run of fieldRuns) {
2769
+ if (!(run instanceof Run)) continue;
2769
2770
  const runContent = run.getContent();
2770
2771
  const fieldCharToken = runContent.find((c: any) => c.type === 'fieldChar');
2771
2772
 
@@ -2816,6 +2817,7 @@ export class DocumentParser {
2816
2817
  let hasSeparate = false;
2817
2818
 
2818
2819
  for (const run of fieldRuns) {
2820
+ if (!(run instanceof Run)) continue;
2819
2821
  const runContent = run.getContent();
2820
2822
  const instrText = runContent.find((c: any) => c.type === 'instructionText');
2821
2823
  if (instrText) {
@@ -3105,8 +3107,9 @@ export class DocumentParser {
3105
3107
  } else {
3106
3108
  // Non-run content (hyperlinks, images, etc.)
3107
3109
  if (nestingDepth > 0) {
3108
- // Inside a nested field - keep collecting
3109
- fieldRuns.push(item as any);
3110
+ // Non-Run items (e.g., w:proofErr) can't be processed as field runs.
3111
+ // Drop them — Word regenerates these markers on open.
3112
+ continue;
3110
3113
  } else if (fieldRuns.length > 0) {
3111
3114
  // Incomplete field - add as individual runs
3112
3115
  fieldRuns.forEach((run) => groupedContent.push(run));
@@ -3612,6 +3615,7 @@ export class DocumentParser {
3612
3615
  let formFieldData: any = undefined;
3613
3616
 
3614
3617
  for (const run of fieldRuns) {
3618
+ if (!(run instanceof Run)) continue;
3615
3619
  const runContent = run.getContent();
3616
3620
 
3617
3621
  // Check for fieldChar tokens
@@ -3656,6 +3660,7 @@ export class DocumentParser {
3656
3660
  const resultContentElements: XMLElement[] = [];
3657
3661
  let pastSeparator = false;
3658
3662
  for (const run of fieldRuns) {
3663
+ if (!(run instanceof Run)) continue;
3659
3664
  const rc = run.getContent();
3660
3665
  const fc = rc.find((c: any) => c.type === 'fieldChar');
3661
3666
  if (fc?.fieldCharType === 'separate') {