@harbour-enterprises/superdoc 2.0.0-next.8 → 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.
- package/dist/chunks/{PdfViewer-Do6Fwxg6.es.js → PdfViewer-CNPSrXlj.es.js} +1 -1
- package/dist/chunks/{PdfViewer-B9CqbRwb.cjs → PdfViewer-DsT_w4-X.cjs} +1 -1
- package/dist/chunks/{index-irAVws9u.es.js → index-BDVCqES7.es.js} +3 -3
- package/dist/chunks/{index-BenJjJks-D2bzxDYh.es.js → index-DGXC37hB-B7UYG5g_.es.js} +1 -1
- package/dist/chunks/{index-BenJjJks-BKrQ08cZ.cjs → index-DGXC37hB-BZN6aZyV.cjs} +1 -1
- package/dist/chunks/{index-AWdTcD50.cjs → index-Xx6AaBZS.cjs} +3 -3
- package/dist/chunks/{super-editor.es-BkQd_jPX.cjs → super-editor.es-BFOdLp_R.cjs} +48 -6
- package/dist/chunks/{super-editor.es-T6MeXgis.es.js → super-editor.es-bATnck82.es.js} +48 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-zhWKWEc1.js → converter-L2w5yBfC.js} +45 -3
- package/dist/super-editor/chunks/{docx-zipper-D_hjsmAn.js → docx-zipper-DNw1qYEn.js} +1 -1
- package/dist/super-editor/chunks/{editor-Bd549Ee3.js → editor-DnidDUVK.js} +5 -5
- package/dist/super-editor/chunks/{index-BenJjJks.js → index-DGXC37hB.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-YbPoc0AP.js → toolbar-C2AE--wJ.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +50 -8
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -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
|
|
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(
|
|
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.
|
|
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.
|
|
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(() =>
|
|
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.
|
|
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");
|
|
@@ -157817,7 +157859,7 @@ ${style2}
|
|
|
157817
157859
|
this.config.colors = shuffleArray(this.config.colors);
|
|
157818
157860
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
157819
157861
|
this.colorIndex = 0;
|
|
157820
|
-
this.version = "2.0.0-next.
|
|
157862
|
+
this.version = "2.0.0-next.9";
|
|
157821
157863
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
157822
157864
|
this.superdocId = config2.superdocId || v4();
|
|
157823
157865
|
this.colors = this.config.colors;
|
|
@@ -160290,7 +160332,7 @@ ${style2}
|
|
|
160290
160332
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
160291
160333
|
);
|
|
160292
160334
|
}
|
|
160293
|
-
const
|
|
160335
|
+
const indexDGXC37hB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
160294
160336
|
__proto__: null,
|
|
160295
160337
|
unified
|
|
160296
160338
|
}, Symbol.toStringTag, { value: "Module" }));
|