@office-open/docx 0.14.1 → 0.14.2

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/index.mjs CHANGED
@@ -2513,6 +2513,15 @@ function spacingStr(opts) {
2513
2513
  })}/>`;
2514
2514
  }
2515
2515
  function indentStr(opts) {
2516
+ let { hanging, firstLine } = opts;
2517
+ if (typeof firstLine === "number" && firstLine < 0) {
2518
+ hanging ??= -firstLine;
2519
+ firstLine = void 0;
2520
+ }
2521
+ if (typeof hanging === "number" && hanging < 0) {
2522
+ firstLine ??= -hanging;
2523
+ hanging = void 0;
2524
+ }
2516
2525
  return `<w:ind${attrsRaw({
2517
2526
  "w:start": opts.start !== void 0 ? convertToTwip(opts.start) : void 0,
2518
2527
  "w:startChars": opts.startChars !== void 0 ? decimalNumber(opts.startChars) : void 0,
@@ -2522,9 +2531,9 @@ function indentStr(opts) {
2522
2531
  "w:leftChars": opts.leftChars !== void 0 ? decimalNumber(opts.leftChars) : void 0,
2523
2532
  "w:right": opts.right !== void 0 ? convertToTwip(opts.right) : void 0,
2524
2533
  "w:rightChars": opts.rightChars !== void 0 ? decimalNumber(opts.rightChars) : void 0,
2525
- "w:hanging": opts.hanging !== void 0 ? convertToTwip(opts.hanging) : void 0,
2534
+ "w:hanging": hanging !== void 0 ? convertToTwip(hanging) : void 0,
2526
2535
  "w:hangingChars": opts.hangingChars !== void 0 ? decimalNumber(opts.hangingChars) : void 0,
2527
- "w:firstLine": opts.firstLine !== void 0 ? convertToTwip(opts.firstLine) : void 0,
2536
+ "w:firstLine": firstLine !== void 0 ? convertToTwip(firstLine) : void 0,
2528
2537
  "w:firstLineChars": opts.firstLineChars !== void 0 ? decimalNumber(opts.firstLineChars) : void 0
2529
2538
  })}/>`;
2530
2539
  }
@@ -5679,13 +5688,15 @@ function parseParagraphProperties(el, ctx) {
5679
5688
  const endChars = attrNum(ind, "w:endChars");
5680
5689
  if (endChars !== void 0) indentObj.endChars = endChars;
5681
5690
  const hanging = attrMeasure(ind, "w:hanging");
5682
- if (hanging !== void 0) indentObj.hanging = hanging;
5683
5691
  const hangingChars = attrNum(ind, "w:hangingChars");
5684
5692
  if (hangingChars !== void 0) indentObj.hangingChars = hangingChars;
5685
5693
  const firstLine = attrMeasure(ind, "w:firstLine");
5686
- if (firstLine !== void 0) indentObj.firstLine = firstLine;
5687
5694
  const firstLineChars = attrNum(ind, "w:firstLineChars");
5688
5695
  if (firstLineChars !== void 0) indentObj.firstLineChars = firstLineChars;
5696
+ if (typeof hanging === "number" && hanging < 0) indentObj.firstLine ??= -hanging;
5697
+ else if (hanging !== void 0) indentObj.hanging = hanging;
5698
+ if (typeof firstLine === "number" && firstLine < 0) indentObj.hanging ??= -firstLine;
5699
+ else if (firstLine !== void 0) indentObj.firstLine = firstLine;
5689
5700
  if (Object.keys(indentObj).length > 0) opts.indent = indentObj;
5690
5701
  }
5691
5702
  const numPr = findChild(el, "w:numPr");