superdoc 0.30.0-next.5 → 0.30.0-next.7

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 (42) hide show
  1. package/dist/chunks/{PdfViewer-8rHRTfmB.es.js → PdfViewer-CBfKTlkO.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DlTGU48f.cjs → PdfViewer-DAfhpENU.cjs} +1 -1
  3. package/dist/chunks/{index-BAQ7G8ip.es.js → index-D11q4Kk4.es.js} +7 -6
  4. package/dist/chunks/{index-1OJ4hRlJ.cjs → index-D6ktUpVF.cjs} +7 -6
  5. package/dist/chunks/{index-DuZ0Zcpx-CD37LqbK.es.js → index-K8x_ZMJI-BhsVHeXy.es.js} +1 -1
  6. package/dist/chunks/{index-DuZ0Zcpx-DkylYv_-.cjs → index-K8x_ZMJI-BrnvF8W6.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-CItbU3fH.cjs → super-editor.es-DKjs4Vsm.cjs} +51 -27
  8. package/dist/chunks/{super-editor.es-D0SDU51r.es.js → super-editor.es-DgBDoeNs.es.js} +51 -27
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  11. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  12. package/dist/style.css +1 -0
  13. package/dist/super-editor/ai-writer.es.js +2 -2
  14. package/dist/super-editor/chunks/{converter-DlG29jx8.js → converter-CV0ojpfw.js} +10 -9
  15. package/dist/super-editor/chunks/{docx-zipper-DGDhr6WV.js → docx-zipper-OIsx4R0Z.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-Bp_OjOzF.js → editor-Dj784nAk.js} +43 -20
  17. package/dist/super-editor/chunks/{index-DuZ0Zcpx.js → index-K8x_ZMJI.js} +1 -1
  18. package/dist/super-editor/chunks/{toolbar-DWYE9phW.js → toolbar-B9Usxj75.js} +2 -2
  19. package/dist/super-editor/converter.es.js +1 -1
  20. package/dist/super-editor/docx-zipper.es.js +2 -2
  21. package/dist/super-editor/editor.es.js +3 -3
  22. package/dist/super-editor/file-zipper.es.js +1 -1
  23. package/dist/super-editor/style.css +1 -0
  24. package/dist/super-editor/super-editor/src/core/helpers/list-numbering-helpers.d.ts.map +1 -1
  25. package/dist/super-editor/super-editor/src/core/helpers/orderedListUtils.d.ts.map +1 -1
  26. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts.map +1 -1
  27. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/extensions/paragraph/ParagraphNodeView.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/extensions/paragraph/numberingPlugin.d.ts.map +1 -1
  30. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
  31. package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +1 -0
  32. package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  34. package/dist/super-editor/super-editor.es.js +6 -6
  35. package/dist/super-editor/toolbar.es.js +2 -2
  36. package/dist/super-editor.cjs +1 -1
  37. package/dist/super-editor.es.js +1 -1
  38. package/dist/superdoc.cjs +2 -2
  39. package/dist/superdoc.es.js +2 -2
  40. package/dist/superdoc.umd.js +57 -32
  41. package/dist/superdoc.umd.js.map +1 -1
  42. package/package.json +1 -1
@@ -15397,6 +15397,9 @@
15397
15397
  let [value, unit] = parseSizeUnit(lineHeight2);
15398
15398
  if (Number.isNaN(value) || value === 0) return {};
15399
15399
  if (lineRule === "atLeast" && value < 1) return {};
15400
+ if (!unit && value < 1) {
15401
+ value = 1;
15402
+ }
15400
15403
  unit = unit ? unit : defaultUnit;
15401
15404
  return isObject2 ? { ["line-height"]: `${value}${unit}` } : `line-height: ${value}${unit}`;
15402
15405
  };
@@ -27480,7 +27483,12 @@
27480
27483
  }
27481
27484
  const findElement = (name) => listDefinition.elements?.find((item) => item.name === name);
27482
27485
  const startElement = findElement("w:start");
27483
- const numFmtElement = findElement("w:numFmt");
27486
+ let numFmtElement = findElement("w:numFmt");
27487
+ if (!numFmtElement) {
27488
+ const mcAlternate = listDefinition.elements?.find((item) => item.name === "mc:AlternateContent");
27489
+ const choice = mcAlternate?.elements?.find((el) => el.name === "mc:Choice");
27490
+ numFmtElement = choice?.elements?.find((item) => item.name === "w:numFmt");
27491
+ }
27484
27492
  const lvlTextElement = findElement("w:lvlText");
27485
27493
  const suffixElement = findElement("w:suff");
27486
27494
  const lvlJcElement = findElement("w:lvlJc");
@@ -33950,13 +33958,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33950
33958
  importListDefs[numericKey] = value;
33951
33959
  }
33952
33960
  });
33953
- const listDefsEntries = Object.entries(importListDefs);
33954
- const foundByDurableId = listDefsEntries.filter(([, def2]) => def2.attributes?.["w16cid:durableId"] === "485517411");
33955
- if (foundByDurableId.length > 1) {
33956
- importListDefs = Object.fromEntries(
33957
- listDefsEntries.filter(([, def2]) => def2.attributes?.["w16cid:durableId"] !== "485517411")
33958
- );
33959
- }
33960
33961
  return {
33961
33962
  abstracts: abstractDefinitions,
33962
33963
  definitions: importListDefs
@@ -35264,7 +35265,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35264
35265
  static getStoredSuperdocVersion(docx) {
35265
35266
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35266
35267
  }
35267
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.30.0-next.5") {
35268
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.30.0-next.7") {
35268
35269
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35269
35270
  }
35270
35271
  /**
@@ -46709,7 +46710,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
46709
46710
  beforeinput(view, e) {
46710
46711
  let inputType = e.inputType;
46711
46712
  let command2 = inputType == "historyUndo" ? undo$1 : inputType == "historyRedo" ? redo$1 : null;
46712
- if (!command2)
46713
+ if (!command2 || !view.editable)
46713
46714
  return false;
46714
46715
  e.preventDefault();
46715
46716
  return command2(view.state, view.dispatch);
@@ -60327,7 +60328,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60327
60328
  { default: remarkStringify2 },
60328
60329
  { default: remarkGfm2 }
60329
60330
  ] = await Promise.all([
60330
- Promise.resolve().then(() => indexDuZ0Zcpx),
60331
+ Promise.resolve().then(() => indexK8x_ZMJI),
60331
60332
  Promise.resolve().then(() => indexDRCvimau),
60332
60333
  Promise.resolve().then(() => indexC_x_N6Uh),
60333
60334
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -60545,7 +60546,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60545
60546
  * @returns {Object | void} Migration results
60546
60547
  */
60547
60548
  processCollaborationMigrations() {
60548
- console.debug("[checkVersionMigrations] Current editor version", "0.30.0-next.5");
60549
+ console.debug("[checkVersionMigrations] Current editor version", "0.30.0-next.7");
60549
60550
  if (!this.options.ydoc) return;
60550
60551
  const metaMap = this.options.ydoc.getMap("meta");
60551
60552
  let docVersion = metaMap.get("version");
@@ -63141,12 +63142,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63141
63142
  content2 = node2.content;
63142
63143
  }
63143
63144
  const updatedNode = node2.type.create({ ...node2.attrs, ...options.attrs }, content2, node2.marks);
63144
- try {
63145
- updatedNode.check();
63146
- } catch {
63147
- console.error("Updated node does not conform to the schema");
63148
- return false;
63149
- }
63150
63145
  tr.replaceWith(posFrom, posTo, updatedNode);
63151
63146
  }
63152
63147
  return true;
@@ -64167,6 +64162,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64167
64162
  const getSpacingStyleString = (spacing, marks, isListItem) => {
64168
64163
  let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
64169
64164
  line = twipsToLines(line);
64165
+ if (line != null && line < 1) {
64166
+ line = 1;
64167
+ }
64170
64168
  if (lineRule === "exact" && line) {
64171
64169
  line = String(line);
64172
64170
  }
@@ -64768,6 +64766,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64768
64766
  if (paragraphContext.tabHeight === void 0) {
64769
64767
  paragraphContext.tabHeight = calcTabHeight(blockParent2);
64770
64768
  }
64769
+ if (paragraphContext.paragraphWidth === void 0) {
64770
+ paragraphContext.paragraphWidth = getBlockNodeWidth(view, startPos);
64771
+ }
64771
64772
  const indentWidth = paragraphContext.indentWidth;
64772
64773
  const hanging = twipsToPixels(Number(paragraphContext.indent.hanging) || 0);
64773
64774
  if (hanging > 0) {
@@ -64779,7 +64780,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64779
64780
  if (tabStops.length) {
64780
64781
  const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
64781
64782
  if (tabStop) {
64782
- tabWidth = tabStop.pos - currentWidth;
64783
+ tabWidth = Math.min(tabStop.pos, paragraphContext.paragraphWidth) - currentWidth;
64783
64784
  let val = tabStop.val;
64784
64785
  const aliases = { left: "start", right: "end" };
64785
64786
  if (aliases[val]) val = aliases[val];
@@ -64947,6 +64948,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64947
64948
  }
64948
64949
  return calculateIndentFallback(indentAttrs);
64949
64950
  }
64951
+ function getBlockNodeWidth(view, blockStartPos) {
64952
+ const blockDom = view.nodeDOM(blockStartPos - 1);
64953
+ if (blockDom instanceof HTMLElement) {
64954
+ const styles = window.getComputedStyle(blockDom);
64955
+ const width = blockDom.clientWidth + parseFloat(styles.marginLeft || "0") + parseFloat(styles.marginRight || "0") + parseFloat(styles.borderLeftWidth || "0") + parseFloat(styles.borderRightWidth || "0") + parseFloat(styles.paddingLeft || "0") + parseFloat(styles.paddingRight || "0");
64956
+ return width;
64957
+ }
64958
+ return defaultLineLength;
64959
+ }
64950
64960
  function calculateIndentFallback(indentAttrs = {}) {
64951
64961
  if (!indentAttrs) return 0;
64952
64962
  const left2 = twipsToPixels(Number(indentAttrs.left) || 0);
@@ -65075,6 +65085,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65075
65085
  if (mutation.type === "attributes" && mutation.target === this.dom && mutation.attributeName === "style") {
65076
65086
  return true;
65077
65087
  }
65088
+ if (mutation.type === "childList") {
65089
+ if (this.marker && Array.from(mutation.removedNodes).includes(this.marker)) {
65090
+ return true;
65091
+ }
65092
+ if (this.marker && Array.from(mutation.addedNodes).includes(this.marker)) {
65093
+ return true;
65094
+ }
65095
+ if (this.separator && Array.from(mutation.removedNodes).includes(this.separator)) {
65096
+ return true;
65097
+ }
65098
+ if (this.separator && Array.from(mutation.addedNodes).includes(this.separator)) {
65099
+ return true;
65100
+ }
65101
+ }
65078
65102
  return false;
65079
65103
  }
65080
65104
  destroy() {
@@ -65114,10 +65138,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65114
65138
  createMarker_fn = function(markerText) {
65115
65139
  if (!this.marker) {
65116
65140
  this.marker = document.createElement("span");
65141
+ this.dom.insertBefore(this.marker, this.contentDOM);
65117
65142
  }
65118
65143
  this.marker.contentEditable = "false";
65119
65144
  this.marker.className = "list-marker";
65120
- this.dom.insertBefore(this.marker, this.contentDOM);
65121
65145
  this.marker.textContent = markerText;
65122
65146
  };
65123
65147
  createSeparator_fn = function(suffix2) {
@@ -65125,7 +65149,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65125
65149
  if (this.separator == null || this.separator.tagName?.toLowerCase() !== "span") {
65126
65150
  this.separator?.parentNode?.removeChild(this.separator);
65127
65151
  this.separator = document.createElement("span");
65128
- this.dom.insertBefore(this.separator, this.contentDOM);
65152
+ this.marker.after(this.separator);
65129
65153
  }
65130
65154
  this.separator.className = "sd-editor-tab";
65131
65155
  this.separator.contentEditable = "false";
@@ -65133,14 +65157,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65133
65157
  if (this.separator == null || this.separator.nodeType !== Node.TEXT_NODE) {
65134
65158
  this.separator?.parentNode?.removeChild(this.separator);
65135
65159
  this.separator = document.createTextNode(" ");
65136
- this.dom.insertBefore(this.separator, this.contentDOM);
65160
+ this.marker.after(this.separator);
65137
65161
  }
65138
65162
  this.separator.textContent = " ";
65139
65163
  } else if (suffix2 === "nothing") {
65140
65164
  if (this.separator == null || this.separator.nodeType !== Node.TEXT_NODE) {
65141
65165
  this.separator?.parentNode?.removeChild(this.separator);
65142
65166
  this.separator = document.createTextNode("");
65143
- this.dom.insertBefore(this.separator, this.contentDOM);
65167
+ this.marker.after(this.separator);
65144
65168
  }
65145
65169
  this.separator.textContent = "";
65146
65170
  }
@@ -65343,7 +65367,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65343
65367
  abstractIdMap[numId] = abstractId;
65344
65368
  const restartSetting = startsMap?.[numId]?.[level]?.restart;
65345
65369
  const startValue = startsMap?.[numId]?.[level]?.start ?? 1;
65346
- const levelData = countersMap?.[numId]?.[level] || {};
65370
+ const levelData = abstractCountersMap?.[abstractId]?.[level] || {};
65347
65371
  let previousPos = null;
65348
65372
  let previousCount = startValue - 1;
65349
65373
  if (cacheEnabled) {
@@ -65515,13 +65539,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65515
65539
  return p2;
65516
65540
  };
65517
65541
  const generateFromCustom = (path2, lvlText, customFormat) => {
65518
- if (customFormat !== "001, 002, 003, ...") return generateNumbering(path2, lvlText, String);
65542
+ if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) return generateNumbering(path2, lvlText, String);
65519
65543
  const match = customFormat.match(/(\d+)/);
65520
65544
  if (!match) throw new Error("Invalid format string: no numeric pattern found");
65521
65545
  const sample = match[1];
65522
65546
  const digitCount = sample.length;
65523
- const index2 = path2.pop();
65524
- return String(index2).padStart(digitCount, "0");
65547
+ return generateNumbering(path2, lvlText, (p2) => String(p2).padStart(digitCount, "0"));
65525
65548
  };
65526
65549
  const intToRoman = (num) => {
65527
65550
  const romanNumeralMap = [
@@ -65646,6 +65669,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65646
65669
  }
65647
65670
  let { lvlText, customFormat, listNumberingType, suffix: suffix2, justification, abstractId } = definitionDetails;
65648
65671
  let markerText = "";
65672
+ listNumberingType = listNumberingType || "decimal";
65649
65673
  const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
65650
65674
  numberingManager.setCounter(numId, level, pos, count, abstractId);
65651
65675
  const path2 = numberingManager.calculatePath(numId, level, pos);
@@ -102673,7 +102697,7 @@ ${reason}`);
102673
102697
  const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
102674
102698
  const document2 = superdocStore.getDocument(documentId);
102675
102699
  comments.forEach((comment2) => {
102676
- const htmlContent = getHTmlFromComment(comment2.textJson);
102700
+ const htmlContent = getHtmlFromComment(comment2.textJson);
102677
102701
  if (!htmlContent && !comment2.trackedChange) {
102678
102702
  return;
102679
102703
  }
@@ -102686,12 +102710,13 @@ ${reason}`);
102686
102710
  isInternal: false,
102687
102711
  parentCommentId: comment2.parentCommentId,
102688
102712
  creatorName,
102713
+ createdTime: comment2.createdTime,
102689
102714
  creatorEmail: comment2.creatorEmail,
102690
102715
  importedAuthor: {
102691
102716
  name: importedName,
102692
102717
  email: comment2.creatorEmail
102693
102718
  },
102694
- commentText: getHTmlFromComment(comment2.textJson),
102719
+ commentText: getHtmlFromComment(comment2.textJson),
102695
102720
  resolvedTime: comment2.isDone ? Date.now() : null,
102696
102721
  resolvedByEmail: comment2.isDone ? comment2.creatorEmail : null,
102697
102722
  resolvedByName: comment2.isDone ? importedName : null,
@@ -102799,7 +102824,7 @@ ${reason}`);
102799
102824
  content: normalizedChildren
102800
102825
  };
102801
102826
  };
102802
- const getHTmlFromComment = (commentTextJson) => {
102827
+ const getHtmlFromComment = (commentTextJson) => {
102803
102828
  if (!commentTextJson.content?.length) return;
102804
102829
  try {
102805
102830
  const normalizedContent = normalizeCommentForEditor(commentTextJson);
@@ -116625,7 +116650,7 @@ ${style2}
116625
116650
  this.config.colors = shuffleArray(this.config.colors);
116626
116651
  this.userColorMap = /* @__PURE__ */ new Map();
116627
116652
  this.colorIndex = 0;
116628
- this.version = "0.30.0-next.5";
116653
+ this.version = "0.30.0-next.7";
116629
116654
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
116630
116655
  this.superdocId = config2.superdocId || v4();
116631
116656
  this.colors = this.config.colors;
@@ -119025,7 +119050,7 @@ ${style2}
119025
119050
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
119026
119051
  );
119027
119052
  }
119028
- const indexDuZ0Zcpx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119053
+ const indexK8x_ZMJI = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119029
119054
  __proto__: null,
119030
119055
  unified
119031
119056
  }, Symbol.toStringTag, { value: "Module" }));