@harbour-enterprises/superdoc 0.15.7-next.1 → 0.15.7-next.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.
Files changed (27) hide show
  1. package/dist/chunks/{super-editor.es-wYUD2FbG.cjs → super-editor.es-BZl0f40H.cjs} +174 -81
  2. package/dist/chunks/{super-editor.es-DK_jRQOE.es.js → super-editor.es-CySS7Yji.es.js} +174 -81
  3. package/dist/core/SuperDoc.d.ts +0 -1
  4. package/dist/core/SuperDoc.d.ts.map +1 -1
  5. package/dist/super-editor/ai-writer.es.js +2 -2
  6. package/dist/super-editor/chunks/{converter-DeJTqjPR.js → converter-Cq8wkRD4.js} +173 -80
  7. package/dist/super-editor/chunks/{docx-zipper-vN19SPa8.js → docx-zipper-CXwmm6eO.js} +1 -1
  8. package/dist/super-editor/chunks/{editor-Dd9HYASE.js → editor-BwaURTck.js} +3 -3
  9. package/dist/super-editor/chunks/{toolbar-D0DQ38PV.js → toolbar-CCVzfOoQ.js} +2 -2
  10. package/dist/super-editor/converter.es.js +1 -1
  11. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts +1 -1
  12. package/dist/super-editor/core/helpers/list-numbering-helpers.d.ts.map +1 -1
  13. package/dist/super-editor/core/helpers/pasteListHelpers.d.ts +7 -0
  14. package/dist/super-editor/core/helpers/pasteListHelpers.d.ts.map +1 -0
  15. package/dist/super-editor/core/inputRules/docx-paste/docx-paste.d.ts.map +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  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 +11 -11
  24. package/dist/superdoc.es.js +12 -12
  25. package/dist/superdoc.umd.js +184 -91
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./chunks/super-editor.es-DK_jRQOE.es.js";
2
- import { a, S, d, j, p } from "./chunks/super-editor.es-DK_jRQOE.es.js";
1
+ import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./chunks/super-editor.es-CySS7Yji.es.js";
2
+ import { a, S, d, j, p } from "./chunks/super-editor.es-CySS7Yji.es.js";
3
3
  import { a0 as effectScope, r as ref, $ as markRaw, p as process$1, a1 as toRaw, a as computed, a2 as isRef, a3 as isReactive, D as toRef, i as inject, q as getCurrentInstance, l as watch, y as unref, a4 as hasInjectionContext, N as reactive, u as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, K as shallowRef, O as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, U as onActivated, s as onDeactivated, A as createTextVNode, F as Fragment, R as Comment, m as defineComponent, E as provide, I as withDirectives, C as h, V as Teleport, S as renderSlot, W as isVNode, J as watchEffect, P as Transition, G as mergeProps, Q as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, x as createVNode, z as withCtx, f as createBaseVNode, B as normalizeStyle, e as createCommentVNode, v as createBlock, w as withModifiers, n as normalizeClass, a8 as resolveDirective, d as renderList, c as createApp, X as onUnmounted, Y as resolveDynamicComponent } from "./chunks/vue-B_OPNNfX.es.js";
4
4
  import { B as Buffer$2 } from "./chunks/jszip-BwJb6_S5.es.js";
5
5
  import { B as BlankDOCX } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -47830,8 +47830,8 @@ class SuperDoc extends EventEmitter {
47830
47830
  this.config.colors = shuffleArray(this.config.colors);
47831
47831
  this.userColorMap = /* @__PURE__ */ new Map();
47832
47832
  this.colorIndex = 0;
47833
- this.version = "0.15.7-next.1";
47834
- console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
47833
+ this.version = "0.15.7-next.3";
47834
+ this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
47835
47835
  this.superdocId = config.superdocId || v4();
47836
47836
  this.colors = this.config.colors;
47837
47837
  this.#initDocuments();
@@ -48048,8 +48048,8 @@ class SuperDoc extends EventEmitter {
48048
48048
  broadcastSidebarToggle(isOpened) {
48049
48049
  this.emit("sidebar-toggle", isOpened);
48050
48050
  }
48051
- log(...args) {
48052
- console.debug("🦋 🦸‍♀️ [superdoc]", ...args);
48051
+ #log(...args) {
48052
+ (console.debug ? console.debug : console.log)("🦋 🦸‍♀️ [superdoc]", ...args);
48053
48053
  }
48054
48054
  /**
48055
48055
  * Set the active editor
@@ -48120,7 +48120,7 @@ class SuperDoc extends EventEmitter {
48120
48120
  */
48121
48121
  addCommentsList(element) {
48122
48122
  if (!this.config?.modules?.comments || this.config.role === "viewer") return;
48123
- console.debug("🦋 [superdoc] Adding comments list to:", element);
48123
+ this.#log("🦋 [superdoc] Adding comments list to:", element);
48124
48124
  if (element) this.config.modules.comments.element = element;
48125
48125
  this.commentsList = new SuperComments(this.config.modules?.comments, this);
48126
48126
  if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -48260,7 +48260,7 @@ class SuperDoc extends EventEmitter {
48260
48260
  lockSuperdoc(isLocked = false, lockedBy) {
48261
48261
  this.isLocked = isLocked;
48262
48262
  this.lockedBy = lockedBy;
48263
- console.debug("🦋 [superdoc] Locking superdoc:", isLocked, lockedBy, "\n\n\n");
48263
+ this.#log("🦋 [superdoc] Locking superdoc:", isLocked, lockedBy, "\n\n\n");
48264
48264
  this.emit("locked", { isLocked, lockedBy });
48265
48265
  }
48266
48266
  /**
@@ -48330,7 +48330,7 @@ class SuperDoc extends EventEmitter {
48330
48330
  * @returns {Promise<void>} Resolves when all documents have saved
48331
48331
  */
48332
48332
  async #triggerCollaborationSaves() {
48333
- console.debug("🦋 [superdoc] Triggering collaboration saves");
48333
+ this.#log("🦋 [superdoc] Triggering collaboration saves");
48334
48334
  return new Promise((resolve, reject) => {
48335
48335
  this.superdocStore.documents.forEach((doc) => {
48336
48336
  this.pendingCollaborationSaves = 0;
@@ -48359,9 +48359,9 @@ class SuperDoc extends EventEmitter {
48359
48359
  this.#triggerCollaborationSaves()
48360
48360
  // this.exportEditorsToDOCX(),
48361
48361
  ];
48362
- console.debug("🦋 [superdoc] Saving superdoc");
48362
+ this.#log("🦋 [superdoc] Saving superdoc");
48363
48363
  const result = await Promise.all(savePromises);
48364
- console.debug("🦋 [superdoc] Save complete:", result);
48364
+ this.#log("🦋 [superdoc] Save complete:", result);
48365
48365
  return result;
48366
48366
  }
48367
48367
  /**
@@ -48372,7 +48372,7 @@ class SuperDoc extends EventEmitter {
48372
48372
  if (!this.app) {
48373
48373
  return;
48374
48374
  }
48375
- this.log("[superdoc] Unmounting app");
48375
+ this.#log("[superdoc] Unmounting app");
48376
48376
  this.config.socket?.cancelWebsocketRetry();
48377
48377
  this.config.socket?.disconnect();
48378
48378
  this.config.socket?.destroy();
@@ -30338,20 +30338,62 @@
30338
30338
  isTextSelection,
30339
30339
  posToDOMRect
30340
30340
  }, Symbol.toStringTag, { value: "Module" }));
30341
- const generateNewListDefinition = ({ numId, listType, editor }) => {
30341
+ const generateNewListDefinition = ({ numId, listType, level, start: start2, text, fmt, editor }) => {
30342
30342
  if (typeof listType === "string") listType = editor.schema.nodes[listType];
30343
30343
  const definition = listType.name === "orderedList" ? baseOrderedListDef : baseBulletList;
30344
30344
  const numbering = editor.converter.numbering;
30345
30345
  const newNumbering = { ...numbering };
30346
- const newAbstractId = getNewListId(editor, "abstracts");
30347
- const newAbstractDef = {
30348
- ...definition,
30349
- attributes: {
30350
- ...definition.attributes,
30351
- "w:abstractNumId": String(newAbstractId)
30352
- }
30353
- };
30354
- newNumbering.abstracts[newAbstractId] = newAbstractDef;
30346
+ let skipAddingNewAbstract = false;
30347
+ let newAbstractId = getNewListId(editor, "abstracts");
30348
+ let newAbstractDef = JSON.parse(
30349
+ JSON.stringify({
30350
+ ...definition,
30351
+ attributes: {
30352
+ ...definition.attributes,
30353
+ "w:abstractNumId": String(newAbstractId)
30354
+ }
30355
+ })
30356
+ );
30357
+ if (level && start2 && text && fmt) {
30358
+ if (newNumbering.definitions[numId]) {
30359
+ const abstractId = newNumbering.definitions[numId]?.elements[0]?.attributes["w:val"];
30360
+ newAbstractId = abstractId;
30361
+ const abstract = editor.converter.numbering.abstracts[abstractId];
30362
+ newAbstractDef = { ...abstract };
30363
+ skipAddingNewAbstract = true;
30364
+ }
30365
+ const levelDefIndex = newAbstractDef.elements.findIndex(
30366
+ (el) => el.name === "w:lvl" && el.attributes["w:ilvl"] === level
30367
+ );
30368
+ const levelProps = newAbstractDef.elements[levelDefIndex];
30369
+ const elToFilter = ["w:numFmt", "w:lvlText", "w:start"];
30370
+ const oldElements = levelProps.elements.filter((el) => !elToFilter.includes(el.name));
30371
+ levelProps.elements = [
30372
+ ...oldElements,
30373
+ {
30374
+ type: "element",
30375
+ name: "w:start",
30376
+ attributes: {
30377
+ "w:val": start2
30378
+ }
30379
+ },
30380
+ {
30381
+ type: "element",
30382
+ name: "w:numFmt",
30383
+ attributes: {
30384
+ "w:val": fmt
30385
+ }
30386
+ },
30387
+ {
30388
+ type: "element",
30389
+ name: "w:lvlText",
30390
+ attributes: {
30391
+ "w:val": text
30392
+ }
30393
+ }
30394
+ ];
30395
+ }
30396
+ if (!skipAddingNewAbstract) newNumbering.abstracts[newAbstractId] = newAbstractDef;
30355
30397
  const newNumDef = getBasicNumIdTag(numId, newAbstractId);
30356
30398
  newNumbering.definitions[numId] = newNumDef;
30357
30399
  editor.converter.numbering = newNumbering;
@@ -30583,7 +30625,7 @@
30583
30625
  baseOrderedListDef,
30584
30626
  baseBulletList
30585
30627
  };
30586
- function extractListLevelStyles(cssText, listId, level) {
30628
+ const extractListLevelStyles = (cssText, listId, level) => {
30587
30629
  const pattern = new RegExp(`@list\\s+l${listId}:level${level}\\s*\\{([^}]+)\\}`, "i");
30588
30630
  const match = cssText.match(pattern);
30589
30631
  if (!match) return null;
@@ -30594,14 +30636,58 @@
30594
30636
  styleMap[key] = value;
30595
30637
  }
30596
30638
  return styleMap;
30597
- }
30639
+ };
30598
30640
  const numDefMap = /* @__PURE__ */ new Map([
30599
- ["decimal", { def: "decimal", abstractNum: 1 }],
30600
- ["alpha-lower", { def: "lowerLetter", abstractNum: 1 }],
30601
- ["alpha-upper", { def: "upperLetter", abstractNum: 1 }],
30602
- ["roman-lower", { def: "lowerRoman", abstractNum: 1 }],
30603
- ["roman-upper", { def: "upperRoman", abstractNum: 1 }],
30604
- ["bullet", { def: "bullet", abstractNum: 0 }]
30641
+ ["decimal", "decimal"],
30642
+ ["alpha-lower", "lowerLetter"],
30643
+ ["alpha-upper", "upperLetter"],
30644
+ ["roman-lower", "lowerRoman"],
30645
+ ["roman-upper", "upperRoman"],
30646
+ ["bullet", "bullet"]
30647
+ ]);
30648
+ const numDefByTypeMap = /* @__PURE__ */ new Map([
30649
+ ["1", "decimal"],
30650
+ ["a", "lowerLetter"],
30651
+ ["A", "upperLetter"],
30652
+ ["I", "upperRoman"],
30653
+ ["i", "lowerRoman"]
30654
+ ]);
30655
+ function getStartNumber(lvlText) {
30656
+ const match = lvlText.match(/^(\d+)/);
30657
+ if (match) return parseInt(match[1], 10);
30658
+ return null;
30659
+ }
30660
+ function letterToNumber(letter) {
30661
+ return letter.toLowerCase().charCodeAt(0) - "a".charCodeAt(0) + 1;
30662
+ }
30663
+ function getStartNumberFromAlpha(lvlText) {
30664
+ const match = lvlText.match(/^([a-zA-Z])/);
30665
+ if (match) return letterToNumber(match[1]);
30666
+ return null;
30667
+ }
30668
+ function romanToNumber(roman) {
30669
+ const map2 = { I: 1, V: 5, X: 10, L: 50, C: 100, D: 500, M: 1e3 };
30670
+ let num = 0, prev = 0;
30671
+ for (let i2 = roman.length - 1; i2 >= 0; i2--) {
30672
+ const curr = map2[roman[i2].toUpperCase()] || 0;
30673
+ if (curr < prev) num -= curr;
30674
+ else num += curr;
30675
+ prev = curr;
30676
+ }
30677
+ return num;
30678
+ }
30679
+ function getStartNumberFromRoman(lvlText) {
30680
+ const match = lvlText.match(/^([ivxlcdmIVXLCDM]+)/);
30681
+ if (match) return romanToNumber(match[1]);
30682
+ return null;
30683
+ }
30684
+ const startHelperMap = /* @__PURE__ */ new Map([
30685
+ ["decimal", getStartNumber],
30686
+ ["lowerLetter", getStartNumberFromAlpha],
30687
+ ["upperLetter", getStartNumberFromAlpha],
30688
+ ["lowerRoman", getStartNumberFromRoman],
30689
+ ["upperRoman", getStartNumberFromRoman],
30690
+ ["bullet", () => 1]
30605
30691
  ]);
30606
30692
  const handleDocxPaste = (html, editor, view, plugin2) => {
30607
30693
  const { converter } = editor;
@@ -30610,35 +30696,50 @@
30610
30696
  cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
30611
30697
  const tempDiv = document.createElement("div");
30612
30698
  tempDiv.innerHTML = cleanedHtml;
30613
- const paragraphs = tempDiv.querySelectorAll("p");
30614
- paragraphs.forEach((p2) => {
30615
- const innerHTML2 = p2.innerHTML;
30616
- if (!innerHTML2.includes("<!--[if !supportLists]")) return;
30617
- const styleAttr = p2.getAttribute("style") || "";
30699
+ const data = tempDiv.querySelectorAll("p, li");
30700
+ const startMap = {};
30701
+ data.forEach((item) => {
30702
+ let type2;
30703
+ if (item.localName === "li") {
30704
+ type2 = "listItem";
30705
+ } else {
30706
+ const html2 = item.innerHTML;
30707
+ type2 = "p";
30708
+ if (!html2.includes("<!--[if !supportLists]")) return;
30709
+ }
30710
+ const styleAttr = item.getAttribute("style") || "";
30618
30711
  const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)\s+lfo(\d+)/);
30619
30712
  const css = tempDiv.querySelector("style").innerHTML;
30620
30713
  if (msoListMatch) {
30621
30714
  const [, abstractId, level, numId] = msoListMatch;
30622
30715
  const styles = extractListLevelStyles(css, abstractId, level);
30623
- const msoNumFormat = styles["mso-level-number-format"] || "decimal";
30624
- const abstractOverride = numDefMap.get(msoNumFormat);
30625
- if (!numId) return;
30626
- const abstractDefinition = getListAbstractDefinition(
30627
- abstractOverride ? abstractOverride.abstractNum : numId,
30628
- editor
30629
- );
30630
- let { lvlText, start: start2, numFmt } = getLevelDefinition(abstractDefinition, level);
30631
- if (abstractOverride.abstractNum === 1) lvlText = `%${level}.`;
30632
- p2.setAttribute("data-num-id", numId);
30633
- p2.setAttribute("data-list-level", level - 1);
30634
- p2.setAttribute("data-start", start2);
30635
- p2.setAttribute("data-lvl-text", styles["mso-level-text"] || lvlText);
30636
- p2.setAttribute("data-num-fmt", abstractOverride.def || numFmt);
30716
+ let start2, numFmt, lvlText;
30717
+ if (type2 === "listItem") {
30718
+ const listType = item.parentNode.getAttribute("type");
30719
+ const startAttr = item.parentNode.getAttribute("start");
30720
+ if (!startMap[numId]) startMap[numId] = startAttr;
30721
+ start2 = startMap[numId];
30722
+ numFmt = numDefByTypeMap.get(listType);
30723
+ lvlText = `%${level}.`;
30724
+ } else {
30725
+ const msoNumFormat = styles["mso-level-number-format"] || "decimal";
30726
+ numFmt = numDefMap.get(msoNumFormat);
30727
+ const punc = item.children[0]?.innerText?.slice(-1) || ".";
30728
+ lvlText = numFmt === "bullet" ? normalizeLvlTextChar(styles["mso-level-text"]) : `%${level}${punc}`;
30729
+ const startGetter = startHelperMap.get(numFmt);
30730
+ if (!startMap[numId]) startMap[numId] = startGetter(item.children[0]?.innerText || "1");
30731
+ start2 = startMap[numId];
30732
+ }
30733
+ item.setAttribute("data-num-id", numId);
30734
+ item.setAttribute("data-list-level", parseInt(level) - 1);
30735
+ item.setAttribute("data-start", start2);
30736
+ item.setAttribute("data-lvl-text", lvlText);
30737
+ item.setAttribute("data-num-fmt", numFmt);
30637
30738
  const ptToPxRatio = 1.333;
30638
30739
  const indent = parseInt(styles["margin-left"]) * ptToPxRatio || 0;
30639
- if (indent > 0) p2.setAttribute("data-left-indent", indent);
30740
+ if (indent > 0) item.setAttribute("data-left-indent", indent);
30640
30741
  }
30641
- extractAndRemoveConditionalPrefix(p2);
30742
+ extractAndRemoveConditionalPrefix(item);
30642
30743
  });
30643
30744
  transformWordLists(tempDiv, editor);
30644
30745
  const doc2 = DOMParser$1.fromSchema(editor.schema).parse(tempDiv);
@@ -30648,37 +30749,29 @@
30648
30749
  dispatch(view.state.tr.replaceSelectionWith(doc2, true));
30649
30750
  return true;
30650
30751
  };
30651
- const getLevelDefinition = (abstractDefinition, level) => {
30652
- if (!abstractDefinition || !abstractDefinition.elements) return null;
30653
- const levelElement = abstractDefinition.elements.find((el) => {
30654
- return el.name === "w:lvl" && el.attributes?.["w:ilvl"] == level;
30655
- });
30656
- if (!levelElement) return null;
30657
- const { elements } = levelElement;
30658
- const lvlText = elements.find((el) => el.name === "w:lvlText")?.attributes?.["w:val"];
30659
- const start2 = elements.find((el) => el.name === "w:start")?.attributes?.["w:val"];
30660
- const numFmt = elements.find((el) => el.name === "w:numFmt")?.attributes?.["w:val"];
30661
- return { lvlText, start: start2, numFmt, elements };
30662
- };
30663
- const getListAbstractDefinition = (abstractId, editor) => {
30664
- const { abstracts = {} } = editor?.converter?.numbering;
30665
- return abstracts[abstractId] || null;
30666
- };
30667
30752
  const transformWordLists = (container, editor) => {
30668
- const paragraphs = Array.from(container.querySelectorAll("p[data-num-id]"));
30753
+ const listItems = Array.from(container.querySelectorAll("[data-num-id]"));
30669
30754
  const lists = {};
30670
30755
  const mappedLists = {};
30671
- for (const p2 of paragraphs) {
30672
- const level = parseInt(p2.getAttribute("data-list-level"));
30673
- const numFmt = p2.getAttribute("data-num-fmt");
30674
- const start2 = p2.getAttribute("data-start");
30675
- const lvlText = p2.getAttribute("data-lvl-text");
30676
- const indent = p2.getAttribute("data-left-indent");
30677
- const importedId = p2.getAttribute("data-num-id");
30756
+ for (const item of listItems) {
30757
+ const level = parseInt(item.getAttribute("data-list-level"));
30758
+ const numFmt = item.getAttribute("data-num-fmt");
30759
+ const start2 = item.getAttribute("data-start");
30760
+ const lvlText = item.getAttribute("data-lvl-text");
30761
+ const indent = item.getAttribute("data-left-indent");
30762
+ const importedId = item.getAttribute("data-num-id");
30678
30763
  if (!mappedLists[importedId]) mappedLists[importedId] = ListHelpers.getNewListId(editor);
30679
30764
  const id = mappedLists[importedId];
30680
30765
  const listType = numFmt === "bullet" ? "bulletList" : "orderedList";
30681
- ListHelpers.generateNewListDefinition({ numId: id, listType, editor });
30766
+ ListHelpers.generateNewListDefinition({
30767
+ numId: id,
30768
+ listType,
30769
+ level: level.toString(),
30770
+ start: start2,
30771
+ fmt: numFmt,
30772
+ text: lvlText,
30773
+ editor
30774
+ });
30682
30775
  if (!lists[id]) lists[id] = { levels: {} };
30683
30776
  const currentListByNumId = lists[id];
30684
30777
  if (!currentListByNumId.levels[level]) currentListByNumId.levels[level] = Number(start2) || 1;
@@ -30692,28 +30785,28 @@
30692
30785
  const path = generateListPath(level, currentListByNumId.levels, start2);
30693
30786
  if (!path.length) path.push(currentListByNumId.levels[level]);
30694
30787
  const li = document.createElement("li");
30695
- li.innerHTML = p2.innerHTML;
30788
+ li.innerHTML = item.innerHTML;
30696
30789
  li.setAttribute("data-num-id", id);
30697
30790
  li.setAttribute("data-list-level", JSON.stringify(path));
30698
30791
  li.setAttribute("data-level", level);
30699
30792
  li.setAttribute("data-lvl-text", lvlText);
30700
30793
  li.setAttribute("data-num-fmt", numFmt);
30701
30794
  if (indent) li.setAttribute("data-indent", JSON.stringify({ left: indent }));
30702
- if (p2.hasAttribute("data-font-family")) {
30703
- li.setAttribute("data-font-family", p2.getAttribute("data-font-family"));
30795
+ if (item.hasAttribute("data-font-family")) {
30796
+ li.setAttribute("data-font-family", item.getAttribute("data-font-family"));
30704
30797
  }
30705
- if (p2.hasAttribute("data-font-size")) {
30706
- li.setAttribute("data-font-size", p2.getAttribute("data-font-size"));
30798
+ if (item.hasAttribute("data-font-size")) {
30799
+ li.setAttribute("data-font-size", item.getAttribute("data-font-size"));
30707
30800
  }
30708
- const parentNode2 = p2.parentNode;
30801
+ const parentNode2 = item.parentNode;
30709
30802
  let listForLevel;
30710
30803
  const newList = numFmt === "bullet" ? document.createElement("ul") : document.createElement("ol");
30711
30804
  newList.setAttribute("data-list-id", id);
30712
30805
  newList.level = level;
30713
- parentNode2.insertBefore(newList, p2);
30806
+ parentNode2.insertBefore(newList, item);
30714
30807
  listForLevel = newList;
30715
30808
  listForLevel.appendChild(li);
30716
- p2.remove();
30809
+ item.remove();
30717
30810
  }
30718
30811
  };
30719
30812
  const generateListPath = (level, levels, start2) => {
@@ -30727,8 +30820,8 @@
30727
30820
  }
30728
30821
  return path;
30729
30822
  };
30730
- function extractAndRemoveConditionalPrefix(p2) {
30731
- const nodes = Array.from(p2.childNodes);
30823
+ function extractAndRemoveConditionalPrefix(item) {
30824
+ const nodes = Array.from(item.childNodes);
30732
30825
  let fontFamily2 = null;
30733
30826
  let fontSize2 = null;
30734
30827
  let start2 = -1, end2 = -1;
@@ -30749,10 +30842,10 @@
30749
30842
  }
30750
30843
  }
30751
30844
  for (let i2 = end2; i2 >= start2; i2--) {
30752
- p2.removeChild(p2.childNodes[i2]);
30845
+ item.removeChild(item.childNodes[i2]);
30753
30846
  }
30754
- if (fontFamily2) p2.setAttribute("data-font-family", fontFamily2);
30755
- if (fontSize2) p2.setAttribute("data-font-size", fontSize2);
30847
+ if (fontFamily2) item.setAttribute("data-font-family", fontFamily2);
30848
+ if (fontSize2) item.setAttribute("data-font-size", fontSize2);
30756
30849
  }
30757
30850
  }
30758
30851
  const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
@@ -33478,7 +33571,7 @@
33478
33571
  const cellBordersElement = {
33479
33572
  name: "w:tcBorders",
33480
33573
  elements: Object.entries(borders).map(([key, value]) => {
33481
- if (!value.size) {
33574
+ if (!value.size || value.val === "none") {
33482
33575
  return {
33483
33576
  name: `w:${key}`,
33484
33577
  attributes: {
@@ -36298,7 +36391,7 @@
36298
36391
  return;
36299
36392
  }
36300
36393
  }
36301
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.7-next.1") {
36394
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.7-next.3") {
36302
36395
  const customLocation = "docProps/custom.xml";
36303
36396
  if (!docx[customLocation]) {
36304
36397
  docx[customLocation] = generateCustomXml();
@@ -36777,7 +36870,7 @@
36777
36870
  function generateCustomXml() {
36778
36871
  return DEFAULT_CUSTOM_XML;
36779
36872
  }
36780
- function generateSuperdocVersion(pid = 2, version2 = "0.15.7-next.1") {
36873
+ function generateSuperdocVersion(pid = 2, version2 = "0.15.7-next.3") {
36781
36874
  return {
36782
36875
  type: "element",
36783
36876
  name: "property",
@@ -53104,7 +53197,7 @@
53104
53197
  * @returns {Object | void} Migration results
53105
53198
  */
53106
53199
  processCollaborationMigrations() {
53107
- console.debug("[checkVersionMigrations] Current editor version", "0.15.7-next.1");
53200
+ console.debug("[checkVersionMigrations] Current editor version", "0.15.7-next.3");
53108
53201
  if (!this.options.ydoc) return;
53109
53202
  const metaMap = this.options.ydoc.getMap("meta");
53110
53203
  let docVersion = metaMap.get("version");
@@ -99926,8 +100019,8 @@ ${style2}
99926
100019
  this.config.colors = shuffleArray(this.config.colors);
99927
100020
  this.userColorMap = /* @__PURE__ */ new Map();
99928
100021
  this.colorIndex = 0;
99929
- this.version = "0.15.7-next.1";
99930
- console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
100022
+ this.version = "0.15.7-next.3";
100023
+ this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
99931
100024
  this.superdocId = config.superdocId || v4();
99932
100025
  this.colors = this.config.colors;
99933
100026
  this.#initDocuments();
@@ -100144,8 +100237,8 @@ ${style2}
100144
100237
  broadcastSidebarToggle(isOpened) {
100145
100238
  this.emit("sidebar-toggle", isOpened);
100146
100239
  }
100147
- log(...args) {
100148
- console.debug("🦋 🦸‍♀️ [superdoc]", ...args);
100240
+ #log(...args) {
100241
+ (console.debug ? console.debug : console.log)("🦋 🦸‍♀️ [superdoc]", ...args);
100149
100242
  }
100150
100243
  /**
100151
100244
  * Set the active editor
@@ -100216,7 +100309,7 @@ ${style2}
100216
100309
  */
100217
100310
  addCommentsList(element) {
100218
100311
  if (!this.config?.modules?.comments || this.config.role === "viewer") return;
100219
- console.debug("🦋 [superdoc] Adding comments list to:", element);
100312
+ this.#log("🦋 [superdoc] Adding comments list to:", element);
100220
100313
  if (element) this.config.modules.comments.element = element;
100221
100314
  this.commentsList = new SuperComments(this.config.modules?.comments, this);
100222
100315
  if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -100356,7 +100449,7 @@ ${style2}
100356
100449
  lockSuperdoc(isLocked = false, lockedBy) {
100357
100450
  this.isLocked = isLocked;
100358
100451
  this.lockedBy = lockedBy;
100359
- console.debug("🦋 [superdoc] Locking superdoc:", isLocked, lockedBy, "\n\n\n");
100452
+ this.#log("🦋 [superdoc] Locking superdoc:", isLocked, lockedBy, "\n\n\n");
100360
100453
  this.emit("locked", { isLocked, lockedBy });
100361
100454
  }
100362
100455
  /**
@@ -100426,7 +100519,7 @@ ${style2}
100426
100519
  * @returns {Promise<void>} Resolves when all documents have saved
100427
100520
  */
100428
100521
  async #triggerCollaborationSaves() {
100429
- console.debug("🦋 [superdoc] Triggering collaboration saves");
100522
+ this.#log("🦋 [superdoc] Triggering collaboration saves");
100430
100523
  return new Promise((resolve2, reject) => {
100431
100524
  this.superdocStore.documents.forEach((doc2) => {
100432
100525
  this.pendingCollaborationSaves = 0;
@@ -100455,9 +100548,9 @@ ${style2}
100455
100548
  this.#triggerCollaborationSaves()
100456
100549
  // this.exportEditorsToDOCX(),
100457
100550
  ];
100458
- console.debug("🦋 [superdoc] Saving superdoc");
100551
+ this.#log("🦋 [superdoc] Saving superdoc");
100459
100552
  const result = await Promise.all(savePromises);
100460
- console.debug("🦋 [superdoc] Save complete:", result);
100553
+ this.#log("🦋 [superdoc] Save complete:", result);
100461
100554
  return result;
100462
100555
  }
100463
100556
  /**
@@ -100468,7 +100561,7 @@ ${style2}
100468
100561
  if (!this.app) {
100469
100562
  return;
100470
100563
  }
100471
- this.log("[superdoc] Unmounting app");
100564
+ this.#log("[superdoc] Unmounting app");
100472
100565
  this.config.socket?.cancelWebsocketRetry();
100473
100566
  this.config.socket?.disconnect();
100474
100567
  this.config.socket?.destroy();