@harbour-enterprises/superdoc 2.0.0-next.7 → 2.0.0-next.9

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/{PdfViewer-DJcF4vHT.es.js → PdfViewer-CNPSrXlj.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-FweBhk9D.cjs → PdfViewer-DsT_w4-X.cjs} +1 -1
  3. package/dist/chunks/{index-DaCKjOwK.es.js → index-BDVCqES7.es.js} +3 -3
  4. package/dist/chunks/{index-CxQTFiXW-O-lOD6-A.es.js → index-DGXC37hB-B7UYG5g_.es.js} +1 -1
  5. package/dist/chunks/{index-CxQTFiXW-7XoegSE2.cjs → index-DGXC37hB-BZN6aZyV.cjs} +1 -1
  6. package/dist/chunks/{index-D68il1se.cjs → index-Xx6AaBZS.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-Bd6B_Npe.cjs → super-editor.es-BFOdLp_R.cjs} +53 -8
  8. package/dist/chunks/{super-editor.es-UkB3ld-_.es.js → super-editor.es-bATnck82.es.js} +53 -8
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Dtu-msFQ.js → converter-L2w5yBfC.js} +45 -3
  11. package/dist/super-editor/chunks/{docx-zipper-D2uP_64-.js → docx-zipper-DNw1qYEn.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-CkPpri9l.js → editor-DnidDUVK.js} +10 -7
  13. package/dist/super-editor/chunks/{index-CxQTFiXW.js → index-DGXC37hB.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CNpHAKgS.js → toolbar-C2AE--wJ.js} +2 -2
  15. package/dist/super-editor/converter.es.js +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 +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +55 -10
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-UkB3ld-_.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DaCKjOwK.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-bATnck82.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-BDVCqES7.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -39217,11 +39217,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39217
39217
  }
39218
39218
  if (elements.length === 1) {
39219
39219
  text2 = elements[0].text;
39220
- const xmlSpace = encodedAttrs.xmlSpace ?? elements[0]?.attributes?.["xml:space"];
39220
+ const docXmlSpace = params2.converter?.documentAttributes?.["xml:space"];
39221
+ const xmlSpace = encodedAttrs.xmlSpace ?? attributes?.["xml:space"] ?? elements[0]?.attributes?.["xml:space"] ?? docXmlSpace;
39221
39222
  if (xmlSpace !== "preserve" && typeof text2 === "string") {
39222
39223
  text2 = text2.replace(/^[ \t\n\r]+/, "").replace(/[ \t\n\r]+$/, "");
39223
39224
  }
39224
39225
  text2 = text2.replace(/\[\[sdspace\]\]/g, "");
39226
+ if (xmlSpace !== "preserve" && typeof text2 === "string" && !text2.trim()) {
39227
+ return null;
39228
+ }
39225
39229
  } else if (!elements.length && encodedAttrs.xmlSpace === "preserve") {
39226
39230
  text2 = " ";
39227
39231
  } else return null;
@@ -42204,8 +42208,46 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42204
42208
  this.declaration = this.initialJSON?.declaration;
42205
42209
  this.resolveDocumentGuid();
42206
42210
  }
42211
+ /**
42212
+ * Parses XML content into JSON format while preserving whitespace-only text runs.
42213
+ *
42214
+ * This method wraps xml-js's xml2json parser with additional preprocessing to prevent
42215
+ * the parser from dropping whitespace-only content in <w:t> and <w:delText> elements.
42216
+ * This is critical for correctly handling documents that rely on document-level
42217
+ * xml:space="preserve" rather than per-element attributes, which is common in
42218
+ * PDF-to-DOCX converted documents.
42219
+ *
42220
+ * The whitespace preservation strategy:
42221
+ * 1. Before parsing, wraps whitespace-only content with [[sdspace]] placeholders
42222
+ * 2. xml-js parser preserves the placeholder-wrapped text
42223
+ * 3. During text node processing (t-translator.js), placeholders are removed
42224
+ *
42225
+ * @param {string} xml - The XML string to parse
42226
+ * @returns {Object} The parsed JSON representation of the XML document
42227
+ *
42228
+ * @example
42229
+ * // Handles whitespace-only text runs
42230
+ * const xml = '<w:t> </w:t>';
42231
+ * const result = parseXmlToJson(xml);
42232
+ * // Result preserves the space: { elements: [{ text: '[[sdspace]] [[sdspace]]' }] }
42233
+ *
42234
+ * @example
42235
+ * // Handles elements with attributes
42236
+ * const xml = '<w:t xml:space="preserve"> text </w:t>';
42237
+ * const result = parseXmlToJson(xml);
42238
+ * // Preserves content and attributes
42239
+ *
42240
+ * @example
42241
+ * // Handles both w:t and w:delText elements
42242
+ * const xml = '<w:delText> </w:delText>';
42243
+ * const result = parseXmlToJson(xml);
42244
+ * // Preserves whitespace in deleted text
42245
+ */
42207
42246
  parseXmlToJson(xml2) {
42208
- const newXml = xml2.replace(/(<w:t xml:space="preserve">)(\s+)(<\/w:t>)/g, "$1[[sdspace]]$2[[sdspace]]$3");
42247
+ const newXml = xml2.replace(
42248
+ /(<w:(?:t|delText)(?:\s[^>]*)?>)(\s+)(<\/w:(?:t|delText)>)/g,
42249
+ "$1[[sdspace]]$2[[sdspace]]$3"
42250
+ );
42209
42251
  return JSON.parse(xmljs.xml2json(newXml, null, 2));
42210
42252
  }
42211
42253
  /**
@@ -42428,7 +42470,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42428
42470
  static getStoredSuperdocVersion(docx) {
42429
42471
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42430
42472
  }
42431
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.7") {
42473
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.9") {
42432
42474
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42433
42475
  }
42434
42476
  /**
@@ -68384,7 +68426,7 @@ ${err.toString()}`);
68384
68426
  const shouldSkipNodeView = (editor) => {
68385
68427
  return isHeadless(editor);
68386
68428
  };
68387
- const summaryVersion = "2.0.0-next.7";
68429
+ const summaryVersion = "2.0.0-next.9";
68388
68430
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
68389
68431
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
68390
68432
  function mapAttributes(attrs) {
@@ -69173,7 +69215,7 @@ ${err.toString()}`);
69173
69215
  { default: remarkStringify2 },
69174
69216
  { default: remarkGfm2 }
69175
69217
  ] = await Promise.all([
69176
- Promise.resolve().then(() => indexCxQTFiXW),
69218
+ Promise.resolve().then(() => indexDGXC37hB),
69177
69219
  Promise.resolve().then(() => indexDRCvimau),
69178
69220
  Promise.resolve().then(() => indexC_x_N6Uh),
69179
69221
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -69378,7 +69420,7 @@ ${err.toString()}`);
69378
69420
  * Process collaboration migrations
69379
69421
  */
69380
69422
  processCollaborationMigrations() {
69381
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.7");
69423
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.9");
69382
69424
  if (!this.options.ydoc) return;
69383
69425
  const metaMap = this.options.ydoc.getMap("meta");
69384
69426
  let docVersion = metaMap.get("version");
@@ -94248,7 +94290,10 @@ ${l}
94248
94290
  tabStops: cloneIfObject(resolvedExtended.tabStops),
94249
94291
  keepLines: resolvedExtended.keepLines,
94250
94292
  keepNext: resolvedExtended.keepNext,
94251
- numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties)
94293
+ numberingProperties: cloneIfObject(resolvedAsRecord.numberingProperties),
94294
+ // Extract contextualSpacing from style resolution - this is a sibling to spacing in OOXML,
94295
+ // not nested within it. When true, suppresses spacing between paragraphs of the same style.
94296
+ contextualSpacing: resolvedExtended.contextualSpacing
94252
94297
  };
94253
94298
  return hydrated;
94254
94299
  };
@@ -94983,7 +95028,7 @@ ${l}
94983
95028
  paragraphAttrs.spacing.afterAutospacing = normalizedSpacing.afterAutospacing;
94984
95029
  }
94985
95030
  }
94986
- const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing");
95031
+ const contextualSpacingValue = normalizedSpacing?.contextualSpacing ?? safeGetProperty(paragraphProps, "contextualSpacing") ?? safeGetProperty(attrs, "contextualSpacing") ?? hydrated?.contextualSpacing;
94987
95032
  if (contextualSpacingValue != null) {
94988
95033
  paragraphAttrs.contextualSpacing = isTruthy(contextualSpacingValue);
94989
95034
  }
@@ -157814,7 +157859,7 @@ ${style2}
157814
157859
  this.config.colors = shuffleArray(this.config.colors);
157815
157860
  this.userColorMap = /* @__PURE__ */ new Map();
157816
157861
  this.colorIndex = 0;
157817
- this.version = "2.0.0-next.7";
157862
+ this.version = "2.0.0-next.9";
157818
157863
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
157819
157864
  this.superdocId = config2.superdocId || v4();
157820
157865
  this.colors = this.config.colors;
@@ -160287,7 +160332,7 @@ ${style2}
160287
160332
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
160288
160333
  );
160289
160334
  }
160290
- const indexCxQTFiXW = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
160335
+ const indexDGXC37hB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
160291
160336
  __proto__: null,
160292
160337
  unified
160293
160338
  }, Symbol.toStringTag, { value: "Module" }));