@harbour-enterprises/superdoc 0.12.36-next.1 → 0.12.36-next.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.
Files changed (32) hide show
  1. package/dist/chunks/{index-Dsg_Fwfp.cjs → index-B1MhwjTC.cjs} +2 -2
  2. package/dist/chunks/{index-O7So9dPw.es.js → index-BrSjd1Id.es.js} +1 -1
  3. package/dist/chunks/{index-6-GlnZRv.cjs → index-CMBtuT02.cjs} +1 -1
  4. package/dist/chunks/{index-BxV_npYq.es.js → index-SKpROzLW.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-97KMYuev.es.js → super-editor.es-B-Ph0oqq.es.js} +43 -10
  6. package/dist/chunks/{super-editor.es-BgGd5JMJ.cjs → super-editor.es-aBzjShYE.cjs} +43 -10
  7. package/dist/chunks/{url-C0Uy3mGF.es.js → url-CAZQTNP3.es.js} +1 -1
  8. package/dist/chunks/{url-CrApKLrN.cjs → url-DuggQ5JR.cjs} +1 -1
  9. package/dist/chunks/{xml-js-0gk9Cp_o.cjs → xml-js-B7Vccv2s.cjs} +93 -86
  10. package/dist/chunks/{xml-js-BsXb2vLz.es.js → xml-js-BV-kCPOA.es.js} +93 -86
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-CgDrYGaI.js → converter-C5gjeYUR.js} +3 -8
  13. package/dist/super-editor/chunks/{docx-zipper-CKPolIhW.js → docx-zipper-BepmAdiY.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-BWF8HE4W.js → editor-DNTrx0IA.js} +42 -4
  15. package/dist/super-editor/chunks/{toolbar-BH-Alf-j.js → toolbar-CJjamz6y.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/core/helpers/annotator.d.ts +2 -0
  18. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  19. package/dist/super-editor/core/super-converter/v2/importer/paragraphNodeImporter.d.ts +3 -3
  20. package/dist/super-editor/core/super-converter/v2/importer/paragraphNodeImporter.d.ts.map +1 -1
  21. package/dist/super-editor/docx-zipper.es.js +2 -2
  22. package/dist/super-editor/editor.es.js +3 -3
  23. package/dist/super-editor/file-zipper.es.js +1 -1
  24. package/dist/super-editor/super-editor.es.js +6 -6
  25. package/dist/super-editor/toolbar.es.js +2 -2
  26. package/dist/super-editor.cjs +1 -1
  27. package/dist/super-editor.es.js +1 -1
  28. package/dist/superdoc.cjs +5 -5
  29. package/dist/superdoc.es.js +6 -6
  30. package/dist/superdoc.umd.js +44 -11
  31. package/dist/superdoc.umd.js.map +1 -1
  32. package/package.json +1 -1
@@ -29415,12 +29415,7 @@
29415
29415
  return indent;
29416
29416
  };
29417
29417
  const getParagraphSpacing = (node2, docx, styleId = "", marks = []) => {
29418
- const spacing = {
29419
- lineSpaceAfter: 0,
29420
- lineSpaceBefore: 0,
29421
- line: 0,
29422
- lineRule: null
29423
- };
29418
+ const spacing = {};
29424
29419
  const { spacing: pDefaultSpacing = {} } = getDefaultParagraphStyle(docx, styleId);
29425
29420
  let lineSpaceAfter, lineSpaceBefore, line, lineRuleStyle;
29426
29421
  const pPr = node2.elements?.find((el) => el.name === "w:pPr");
@@ -30669,7 +30664,7 @@
30669
30664
  return;
30670
30665
  }
30671
30666
  }
30672
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.1") {
30667
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.36-next.2") {
30673
30668
  const customLocation = "docProps/custom.xml";
30674
30669
  if (!docx[customLocation]) {
30675
30670
  docx[customLocation] = generateCustomXml();
@@ -31136,7 +31131,7 @@
31136
31131
  function generateCustomXml() {
31137
31132
  return DEFAULT_CUSTOM_XML;
31138
31133
  }
31139
- function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.1") {
31134
+ function generateSuperdocVersion(pid = 2, version2 = "0.12.36-next.2") {
31140
31135
  return {
31141
31136
  type: "element",
31142
31137
  name: "property",
@@ -47596,6 +47591,43 @@
47596
47591
  );
47597
47592
  });
47598
47593
  };
47594
+ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
47595
+ if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
47596
+ const { doc: doc2 } = editor.state;
47597
+ const docxAnnotations = getAllFieldAnnotations(editor.state) || [];
47598
+ const nodesToDelete = [];
47599
+ fieldsToDelete.forEach((fieldId) => {
47600
+ const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
47601
+ if (!matched) return;
47602
+ const listItem = findParentNodeClosestToPos(
47603
+ doc2.resolve(matched.pos),
47604
+ (node22) => node22.type.name === "listItem"
47605
+ );
47606
+ if (!listItem) return;
47607
+ let { pos, node: node2, depth } = listItem;
47608
+ let $pos = doc2.resolve(pos);
47609
+ while (depth > 0) {
47610
+ const parent = $pos.node(depth - 1);
47611
+ if (parent.childCount === 1) {
47612
+ depth -= 1;
47613
+ pos = $pos.before(depth);
47614
+ node2 = parent;
47615
+ $pos = doc2.resolve(pos);
47616
+ } else {
47617
+ break;
47618
+ }
47619
+ }
47620
+ if (!nodesToDelete.some((n) => n.pos === pos)) {
47621
+ nodesToDelete.push({ pos, node: node2 });
47622
+ }
47623
+ });
47624
+ if (!nodesToDelete.length) return;
47625
+ const tr = editor.state.tr;
47626
+ nodesToDelete.sort((a, b) => b.pos - a.pos).forEach(({ pos, node: node2 }) => {
47627
+ tr.delete(pos, pos + node2.nodeSize);
47628
+ });
47629
+ editor.view.dispatch(tr);
47630
+ };
47599
47631
  const AnnotatorHelpers = {
47600
47632
  getFieldAttrs,
47601
47633
  processTables,
@@ -47603,7 +47635,8 @@
47603
47635
  annotateHeadersAndFooters,
47604
47636
  getAllHeaderFooterEditors,
47605
47637
  updateHeaderFooterFieldAnnotations,
47606
- deleteHeaderFooterFieldAnnotations
47638
+ deleteHeaderFooterFieldAnnotations,
47639
+ cleanUpListsWithAnnotations
47607
47640
  };
47608
47641
  const CollaborationPluginKey = new PluginKey("collaboration");
47609
47642
  const Collaboration = Extension.create({
@@ -48413,7 +48446,7 @@
48413
48446
  * @returns {Object | void} Migration results
48414
48447
  */
48415
48448
  processCollaborationMigrations() {
48416
- console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.1");
48449
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.36-next.2");
48417
48450
  if (!this.options.ydoc) return;
48418
48451
  const metaMap = this.options.ydoc.getMap("meta");
48419
48452
  let docVersion = metaMap.get("version");
@@ -89965,7 +89998,7 @@ ${style2}
89965
89998
  this.config.colors = shuffleArray(this.config.colors);
89966
89999
  this.userColorMap = /* @__PURE__ */ new Map();
89967
90000
  this.colorIndex = 0;
89968
- this.version = "0.12.36-next.1";
90001
+ this.version = "0.12.36-next.2";
89969
90002
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
89970
90003
  this.superdocId = config.superdocId || v4();
89971
90004
  this.colors = this.config.colors;