@harbour-enterprises/superdoc 0.12.36-next.3 → 0.12.36-next.5

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.
Files changed (27) hide show
  1. package/dist/chunks/{super-editor.es-CJ7JYnTb.es.js → super-editor.es-B6TDcy20.es.js} +47 -28
  2. package/dist/chunks/{super-editor.es-C0CYAawq.cjs → super-editor.es-D9TzHftk.cjs} +47 -28
  3. package/dist/super-editor/ai-writer.es.js +2 -2
  4. package/dist/super-editor/chunks/{converter-CgZg2BnJ.js → converter-DU5cpw7z.js} +12 -5
  5. package/dist/super-editor/chunks/{docx-zipper-af8QSGql.js → docx-zipper-BcCmb3o0.js} +1 -1
  6. package/dist/super-editor/chunks/{editor-DsMCF0TV.js → editor-D55ux0Iu.js} +37 -25
  7. package/dist/super-editor/chunks/{toolbar-n4Ej7u3_.js → toolbar-CWgcLdNb.js} +2 -2
  8. package/dist/super-editor/converter.es.js +1 -1
  9. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  10. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  11. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  12. package/dist/super-editor/core/super-converter/v2/importer/paragraphNodeImporter.d.ts +3 -3
  13. package/dist/super-editor/core/super-converter/v2/importer/paragraphNodeImporter.d.ts.map +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/extensions/line-height/line-height.d.ts.map +1 -1
  17. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +3 -3
  25. package/dist/superdoc.umd.js +48 -29
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -23434,7 +23434,6 @@
23434
23434
  if (Number.isNaN(value) || value === 0) return {};
23435
23435
  if (lineRule === "atLeast" && value < 1) return {};
23436
23436
  unit = unit ? unit : defaultUnit;
23437
- value += unit ? 4 : 0.2;
23438
23437
  return isObject2 ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
23439
23438
  };
23440
23439
  const deobfuscateFont = (arrayBuffer, guidHex) => {
@@ -26661,7 +26660,10 @@
26661
26660
  if (Array.isArray(outputNode)) {
26662
26661
  const mapped = [];
26663
26662
  outputNode.forEach((el, index22) => {
26664
- mapped.push(...el.elements);
26663
+ el.elements.forEach((element) => {
26664
+ if (element.name === "w:pPr") return;
26665
+ mapped.push(element);
26666
+ });
26665
26667
  if (index22 < outputNode.length - 1) mapped.push({ name: "w:br", type: "element" });
26666
26668
  });
26667
26669
  mapped.unshift(carbonCopy(pPr));
@@ -29415,7 +29417,12 @@
29415
29417
  return indent;
29416
29418
  };
29417
29419
  const getParagraphSpacing = (node2, docx, styleId = "", marks = []) => {
29418
- const spacing = {};
29420
+ const spacing = {
29421
+ lineSpaceAfter: 0,
29422
+ lineSpaceBefore: 0,
29423
+ line: 0,
29424
+ lineRule: null
29425
+ };
29419
29426
  const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
29420
29427
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
29421
29428
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
@@ -30664,7 +30671,7 @@
30664
30671
  return;
30665
30672
  }
30666
30673
  }
30667
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.3") {
30674
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.5") {
30668
30675
  const customLocation = "docProps/custom.xml";
30669
30676
  if (!docx[customLocation]) {
30670
30677
  docx[customLocation] = generateCustomXml();
@@ -31131,7 +31138,7 @@
31131
31138
  function generateCustomXml() {
31132
31139
  return DEFAULT_CUSTOM_XML;
31133
31140
  }
31134
- function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.3") {
31141
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.5") {
31135
31142
  return {
31136
31143
  type: "element",
31137
31144
  name: "property",
@@ -47604,27 +47611,30 @@
47604
47611
  (node22) => node22.type.name === "listItem"
47605
47612
  );
47606
47613
  if (!listItem) return;
47607
- if (listItem.node.childCount !== 1) {
47608
- let remainingNodes = listItem.node.childCount;
47609
- let matchingNodesFound = 0;
47610
- let hasOtherNodes = false;
47611
- listItem.node.children.forEach((child, index2) => {
47612
- const { type: type2 } = child;
47613
- if (type2.name !== "paragraph") return;
47614
- child.children.forEach((inline) => {
47615
- const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
47616
- const isMatchingField = inline.type.name === "fieldAnnotation" && isFieldToDelete;
47617
- const isEmpty2 = inline.childCount === 0;
47618
- if (!isEmpty2 && !isMatchingField) hasOtherNodes = true;
47619
- if (isMatchingField) matchingNodesFound += 1;
47620
- });
47621
- });
47622
- if (!hasOtherNodes && matchingNodesFound > 0) {
47623
- remainingNodes -= matchingNodesFound;
47624
- }
47625
- if (remainingNodes > 0) {
47626
- return;
47614
+ let remainingNodes = 0;
47615
+ listItem.node.descendants((node22) => {
47616
+ if (node22.type.name === "fieldAnnotation") {
47617
+ remainingNodes += 1;
47627
47618
  }
47619
+ });
47620
+ let matchingNodesFound = 0;
47621
+ let hasOtherNodes = false;
47622
+ listItem.node.children.forEach((child, index2) => {
47623
+ const { type: type2 } = child;
47624
+ if (type2.name !== "paragraph" && type2.name !== "fieldAnnotation") return;
47625
+ child.children.forEach((inline) => {
47626
+ const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
47627
+ const isMatchingField = inline.type.name === "fieldAnnotation" && isFieldToDelete;
47628
+ const isEmpty2 = inline.childCount === 0;
47629
+ if (!isEmpty2 && !isMatchingField) hasOtherNodes = true;
47630
+ if (isMatchingField) matchingNodesFound += 1;
47631
+ });
47632
+ });
47633
+ if (!hasOtherNodes && matchingNodesFound > 0) {
47634
+ remainingNodes -= matchingNodesFound;
47635
+ }
47636
+ if (remainingNodes > 0) {
47637
+ return;
47628
47638
  }
47629
47639
  let { pos, node: node2, depth } = listItem;
47630
47640
  let $pos = doc2.resolve(pos);
@@ -48468,7 +48478,7 @@
48468
48478
  * @returns {Object | void} Migration results
48469
48479
  */
48470
48480
  processCollaborationMigrations() {
48471
- console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.3");
48481
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.5");
48472
48482
  if (!this.options.ydoc) return;
48473
48483
  const metaMap = this.options.ydoc.getMap("meta");
48474
48484
  let docVersion = metaMap.get("version");
@@ -49233,7 +49243,14 @@
49233
49243
  parseDOM: (el) => el.style.lineHeight,
49234
49244
  renderDOM: (attrs) => {
49235
49245
  if (!attrs.lineHeight) return {};
49236
- return { style: getLineHeightValueString(attrs.lineHeight, this.options.defaults.unit, attrs.spacing?.lineRule) };
49246
+ const lineHeightStyle = getLineHeightValueString(
49247
+ attrs.lineHeight,
49248
+ this.options.defaults.unit,
49249
+ attrs.spacing?.lineRule
49250
+ );
49251
+ return {
49252
+ style: `${lineHeightStyle}`
49253
+ };
49237
49254
  }
49238
49255
  }
49239
49256
  }
@@ -51158,7 +51175,9 @@
51158
51175
  renderDOM: (attrs) => {
51159
51176
  const { spacing } = attrs;
51160
51177
  if (!spacing) return {};
51161
- const style2 = getSpacingStyleString(spacing);
51178
+ const spacingCopy = { ...spacing };
51179
+ if (attrs.lineHeight) delete spacingCopy.line;
51180
+ const style2 = getSpacingStyleString(spacingCopy);
51162
51181
  if (style2) return { style: style2 };
51163
51182
  return {};
51164
51183
  }
@@ -90020,7 +90039,7 @@ ${style2}
90020
90039
  this.config.colors = shuffleArray(this.config.colors);
90021
90040
  this.userColorMap = /* @__PURE__ */ new Map();
90022
90041
  this.colorIndex = 0;
90023
- this.version = "0.12.36-next.3";
90042
+ this.version = "0.12.36-next.5";
90024
90043
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
90025
90044
  this.superdocId = config.superdocId || v4();
90026
90045
  this.colors = this.config.colors;