superdoc 0.31.0-next.4 → 0.31.0-next.5

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 (38) hide show
  1. package/dist/chunks/{PdfViewer-mTeXBeGP.es.js → PdfViewer-BjFaPQBd.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CMqo3BcJ.cjs → PdfViewer-DXwcotXc.cjs} +1 -1
  3. package/dist/chunks/{index-INrjzFwK.es.js → index-B6TttOzK.es.js} +3 -3
  4. package/dist/chunks/{index-BmNdb0G--hU1qknba.es.js → index-B7dC-H-Q-BeQx_MXI.es.js} +1 -1
  5. package/dist/chunks/{index-BmNdb0G--CqIBE8k-.cjs → index-B7dC-H-Q-DfBEU7rR.cjs} +1 -1
  6. package/dist/chunks/{index-BtYu5_4F.cjs → index-BF_Yvius.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-_Mo5sfTs.cjs → super-editor.es-CVDIAxlg.cjs} +196 -237
  8. package/dist/chunks/{super-editor.es-DUqAKtdo.es.js → super-editor.es-M2e4wbRW.es.js} +196 -237
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BsxkbtGe.js → converter-BIsS-JzD.js} +194 -235
  11. package/dist/super-editor/chunks/{docx-zipper-DzOHQzzj.js → docx-zipper-DVDiaIyD.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-o3FNUBVU.js → editor-ZbcM1RTL.js} +4 -4
  13. package/dist/super-editor/chunks/{index-BmNdb0G-.js → index-B7dC-H-Q.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CbCPJP6P.js → toolbar-8qqw8IXG.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/src/core/super-converter/exporter.d.ts +0 -48
  20. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
  21. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/generate-paragraph-properties.d.ts +8 -0
  22. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/generate-paragraph-properties.d.ts.map +1 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/translate-paragraph-node.d.ts +8 -0
  24. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/translate-paragraph-node.d.ts.map +1 -0
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/convert-sdt-content-to-runs.d.ts +7 -0
  26. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/convert-sdt-content-to-runs.d.ts.map +1 -0
  27. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-field-annotation.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/helpers/translate-text-node.d.ts +5 -0
  29. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/helpers/translate-text-node.d.ts.map +1 -0
  30. package/dist/super-editor/super-editor.es.js +6 -6
  31. package/dist/super-editor/toolbar.es.js +2 -2
  32. package/dist/super-editor.cjs +1 -1
  33. package/dist/super-editor.es.js +1 -1
  34. package/dist/superdoc.cjs +2 -2
  35. package/dist/superdoc.es.js +2 -2
  36. package/dist/superdoc.umd.js +198 -239
  37. package/dist/superdoc.umd.js.map +1 -1
  38. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, y as h, O as Transition, $ as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, v as createVNode, x as unref } from "./vue-CKmzTNVs.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-INrjzFwK.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-B6TttOzK.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-Cwv-wUpm.cjs");
4
- const superdoc = require("./index-BtYu5_4F.cjs");
4
+ const superdoc = require("./index-BF_Yvius.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index, 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 "./super-editor.es-DUqAKtdo.es.js";
1
+ import { q as index, 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 "./super-editor.es-M2e4wbRW.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-hYlnBzSA.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17202,7 +17202,7 @@ const _sfc_main = {
17202
17202
  __name: "SuperDoc",
17203
17203
  emits: ["selection-update"],
17204
17204
  setup(__props, { emit: __emit }) {
17205
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-mTeXBeGP.es.js"));
17205
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BjFaPQBd.es.js"));
17206
17206
  const superdocStore = useSuperdocStore();
17207
17207
  const commentsStore = useCommentsStore();
17208
17208
  const {
@@ -17966,7 +17966,7 @@ class SuperDoc extends EventEmitter {
17966
17966
  this.config.colors = shuffleArray(this.config.colors);
17967
17967
  this.userColorMap = /* @__PURE__ */ new Map();
17968
17968
  this.colorIndex = 0;
17969
- this.version = "0.31.0-next.4";
17969
+ this.version = "0.31.0-next.5";
17970
17970
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17971
17971
  this.superdocId = config.superdocId || v4();
17972
17972
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-DUqAKtdo.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-M2e4wbRW.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-_Mo5sfTs.cjs");
3
+ const superEditor_es = require("./super-editor.es-CVDIAxlg.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-_Mo5sfTs.cjs");
2
+ const superEditor_es = require("./super-editor.es-CVDIAxlg.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DmHNHvFX.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17219,7 +17219,7 @@ const _sfc_main = {
17219
17219
  __name: "SuperDoc",
17220
17220
  emits: ["selection-update"],
17221
17221
  setup(__props, { emit: __emit }) {
17222
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CMqo3BcJ.cjs")));
17222
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DXwcotXc.cjs")));
17223
17223
  const superdocStore = useSuperdocStore();
17224
17224
  const commentsStore = useCommentsStore();
17225
17225
  const {
@@ -17983,7 +17983,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
17983
17983
  this.config.colors = shuffleArray(this.config.colors);
17984
17984
  this.userColorMap = /* @__PURE__ */ new Map();
17985
17985
  this.colorIndex = 0;
17986
- this.version = "0.31.0-next.4";
17986
+ this.version = "0.31.0-next.5";
17987
17987
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17988
17988
  this.superdocId = config.superdocId || uuid.v4();
17989
17989
  this.colors = this.config.colors;
@@ -15426,19 +15426,6 @@ const hasSomeParentWithClass = (element, classname) => {
15426
15426
  if (element.className?.split(" ")?.indexOf(classname) >= 0) return true;
15427
15427
  return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
15428
15428
  };
15429
- function generateDocxRandomId(length2 = 8) {
15430
- const max2 = 2147483647;
15431
- const value = Math.floor(Math.random() * (max2 + 1));
15432
- return value.toString(16).padStart(length2, "0").slice(0, length2);
15433
- }
15434
- function generateRandomSigned32BitIntStrId() {
15435
- const val = Math.floor(Math.random() * 2147483647);
15436
- return val.toString();
15437
- }
15438
- function generateRandom32BitHex() {
15439
- const val = Math.floor(Math.random() * 2147483647);
15440
- return val.toString(16).toUpperCase().padStart(8, "0");
15441
- }
15442
15429
  const DEFAULT_DOCX_DEFS = {
15443
15430
  "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15444
15431
  "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
@@ -16644,15 +16631,6 @@ const COMMENTS_XML_DEFINITIONS = {
16644
16631
  DOCUMENT_RELS_XML_DEF,
16645
16632
  CONTENT_TYPES
16646
16633
  };
16647
- const carbonCopy = (obj) => {
16648
- if (!obj) return void 0;
16649
- try {
16650
- return JSON.parse(JSON.stringify(obj));
16651
- } catch (e) {
16652
- console.error("Error in carbonCopy", obj, e);
16653
- return void 0;
16654
- }
16655
- };
16656
16634
  function translateChildNodes(params2) {
16657
16635
  const { content: nodes } = params2.node;
16658
16636
  if (!nodes) return [];
@@ -18260,6 +18238,15 @@ const config$n = {
18260
18238
  attributes: validXmlAttributes$h
18261
18239
  };
18262
18240
  const translator$21 = NodeTranslator.from(config$n);
18241
+ const carbonCopy = (obj) => {
18242
+ if (!obj) return void 0;
18243
+ try {
18244
+ return JSON.parse(JSON.stringify(obj));
18245
+ } catch (e) {
18246
+ console.error("Error in carbonCopy", obj, e);
18247
+ return void 0;
18248
+ }
18249
+ };
18263
18250
  const mergeTextNodes = (nodes) => {
18264
18251
  if (!nodes || !Array.isArray(nodes)) {
18265
18252
  return nodes;
@@ -20093,6 +20080,56 @@ const handleParagraphNode$1 = (params2) => {
20093
20080
  }
20094
20081
  return schemaNode;
20095
20082
  };
20083
+ function generateParagraphProperties(params2) {
20084
+ const { node } = params2;
20085
+ const { attrs = {} } = node;
20086
+ const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
20087
+ if (attrs.styleId !== paragraphProperties.styleId) {
20088
+ paragraphProperties.styleId = attrs.styleId;
20089
+ }
20090
+ ["borders", "styleId", "indent", "textAlign", "keepLines", "keepNext", "spacing", "tabStops"].forEach((key2) => {
20091
+ let propKey = key2 === "textAlign" ? "justification" : key2;
20092
+ if (JSON.stringify(paragraphProperties[propKey]) !== JSON.stringify(attrs[key2])) {
20093
+ paragraphProperties[propKey] = attrs[key2];
20094
+ }
20095
+ });
20096
+ const framePr = attrs.dropcap;
20097
+ if (framePr) {
20098
+ framePr.dropCap = framePr.type;
20099
+ delete framePr.type;
20100
+ }
20101
+ if (JSON.stringify(paragraphProperties.framePr) !== JSON.stringify(framePr)) {
20102
+ paragraphProperties.framePr = framePr;
20103
+ }
20104
+ const marksProps = decodeRPrFromMarks(attrs.marksAttrs || []);
20105
+ const finalRunProps = combineRunProperties([paragraphProperties.runProperties || {}, marksProps]);
20106
+ paragraphProperties.runProperties = finalRunProps;
20107
+ const pPr = translator$12.decode({ node: { ...node, attrs: { paragraphProperties } } });
20108
+ const sectPr = node.attrs?.paragraphProperties?.sectPr;
20109
+ if (sectPr) {
20110
+ pPr.elements.push(sectPr);
20111
+ }
20112
+ return pPr;
20113
+ }
20114
+ function translateParagraphNode(params2) {
20115
+ const elements = translateChildNodes(params2);
20116
+ const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
20117
+ if (htmlAnnotationChild) {
20118
+ return htmlAnnotationChild.elements;
20119
+ }
20120
+ const pPr = generateParagraphProperties(params2);
20121
+ if (pPr) elements.unshift(pPr);
20122
+ let attributes = {};
20123
+ if (params2.node.attrs?.rsidRDefault) {
20124
+ attributes["w:rsidRDefault"] = params2.node.attrs.rsidRDefault;
20125
+ }
20126
+ const result = {
20127
+ name: "w:p",
20128
+ elements,
20129
+ attributes
20130
+ };
20131
+ return result;
20132
+ }
20096
20133
  const encode$A = (attributes) => {
20097
20134
  return attributes["w:rsidDel"];
20098
20135
  };
@@ -20372,6 +20409,19 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
20372
20409
  }
20373
20410
  return runs;
20374
20411
  };
20412
+ function generateDocxRandomId(length2 = 8) {
20413
+ const max2 = 2147483647;
20414
+ const value = Math.floor(Math.random() * (max2 + 1));
20415
+ return value.toString(16).padStart(length2, "0").slice(0, length2);
20416
+ }
20417
+ function generateRandomSigned32BitIntStrId() {
20418
+ const val = Math.floor(Math.random() * 2147483647);
20419
+ return val.toString();
20420
+ }
20421
+ function generateRandom32BitHex() {
20422
+ const val = Math.floor(Math.random() * 2147483647);
20423
+ return val.toString(16).toUpperCase().padStart(8, "0");
20424
+ }
20375
20425
  const XML_NODE_NAME$j = "w:hyperlink";
20376
20426
  const SD_NODE_NAME$g = "link";
20377
20427
  const _createAttributeHandler = (xmlName, sdName) => ({
@@ -20468,13 +20518,13 @@ function _addNewLinkRelationship(params2, link) {
20468
20518
  type: "element",
20469
20519
  name: "Relationship",
20470
20520
  attributes: {
20471
- Id: id,
20521
+ Id: `rId${id}`,
20472
20522
  Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
20473
20523
  Target: link,
20474
20524
  TargetMode: "External"
20475
20525
  }
20476
20526
  });
20477
- return id;
20527
+ return `rId${id}`;
20478
20528
  }
20479
20529
  const config$i = {
20480
20530
  xmlName: XML_NODE_NAME$j,
@@ -30488,6 +30538,59 @@ const config$c = {
30488
30538
  attributes: validXmlAttributes$6
30489
30539
  };
30490
30540
  const translator$s = NodeTranslator.from(config$c);
30541
+ function getTextNodeForExport(text, marks, params2) {
30542
+ const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
30543
+ const space = hasLeadingOrTrailingSpace ? "preserve" : null;
30544
+ const nodeAttrs = space ? { "xml:space": space } : null;
30545
+ const textNodes = [];
30546
+ const textRunProperties = decodeRPrFromMarks(marks || []);
30547
+ const parentRunProperties = params2.extraParams?.runProperties || {};
30548
+ const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
30549
+ const rPrNode = translator$1N.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
30550
+ textNodes.push({
30551
+ name: "w:t",
30552
+ elements: [{ text, type: "text" }],
30553
+ attributes: nodeAttrs
30554
+ });
30555
+ if (params2) {
30556
+ const { editor } = params2;
30557
+ const customMarks = editor.extensionService.extensions.filter((e) => e.isExternal === true);
30558
+ marks.forEach((mark) => {
30559
+ const isCustomMark = customMarks.some((customMark) => {
30560
+ const customMarkName = customMark.name;
30561
+ return mark.type === customMarkName;
30562
+ });
30563
+ if (!isCustomMark) return;
30564
+ let attrsString = "";
30565
+ Object.entries(mark.attrs).forEach(([key2, value]) => {
30566
+ if (value) {
30567
+ attrsString += `${key2}=${value};`;
30568
+ }
30569
+ });
30570
+ if (isCustomMark) {
30571
+ textNodes.unshift({
30572
+ type: "element",
30573
+ name: "w:bookmarkStart",
30574
+ attributes: {
30575
+ "w:id": "5000",
30576
+ "w:name": mark.type + ";" + attrsString
30577
+ }
30578
+ });
30579
+ textNodes.push({
30580
+ type: "element",
30581
+ name: "w:bookmarkEnd",
30582
+ attributes: {
30583
+ "w:id": "5000"
30584
+ }
30585
+ });
30586
+ }
30587
+ });
30588
+ }
30589
+ return {
30590
+ name: "w:r",
30591
+ elements: rPrNode ? [rPrNode, ...textNodes] : textNodes
30592
+ };
30593
+ }
30491
30594
  var he$2 = { exports: {} };
30492
30595
  /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
30493
30596
  var he$1 = he$2.exports;
@@ -30894,18 +30997,31 @@ function prepareUrlAnnotation(params2) {
30894
30997
  node: { attrs = {}, marks = [] }
30895
30998
  } = params2;
30896
30999
  if (!attrs.linkUrl) return prepareTextAnnotation(params2);
30897
- const newId = addNewLinkRelationship(params2, attrs.linkUrl);
30898
- const linkTextNode = getTextNodeForExport(attrs.linkUrl, marks, params2);
30899
- const contentNode = processLinkContentNode(linkTextNode);
30900
- return {
30901
- name: "w:hyperlink",
30902
- type: "element",
30903
- attributes: {
30904
- "r:id": newId,
30905
- "w:history": 1
30906
- },
30907
- elements: [contentNode]
31000
+ const linkTextNode = {
31001
+ type: "text",
31002
+ text: attrs.linkUrl,
31003
+ marks: [
31004
+ ...marks,
31005
+ {
31006
+ type: "link",
31007
+ attrs: {
31008
+ href: attrs.linkUrl,
31009
+ history: true,
31010
+ text: attrs.linkUrl
31011
+ }
31012
+ },
31013
+ {
31014
+ type: "textStyle",
31015
+ attrs: {
31016
+ color: "#467886"
31017
+ }
31018
+ }
31019
+ ]
30908
31020
  };
31021
+ return translator$10.decode({
31022
+ ...params2,
31023
+ node: linkTextNode
31024
+ });
30909
31025
  }
30910
31026
  function translateFieldAttrsToMarks(attrs = {}) {
30911
31027
  const { fontFamily: fontFamily2, fontSize: fontSize2, bold, underline, italic, textColor, textHighlight } = attrs;
@@ -31098,6 +31214,46 @@ function translateDocumentPartObj(params2) {
31098
31214
  };
31099
31215
  return result;
31100
31216
  }
31217
+ const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
31218
+ function convertSdtContentToRuns(elements) {
31219
+ const normalized = Array.isArray(elements) ? elements : [elements];
31220
+ const runs = [];
31221
+ normalized.forEach((element) => {
31222
+ if (!element) return;
31223
+ if (element.name === "w:sdtPr") {
31224
+ return;
31225
+ }
31226
+ if (element.name === "w:r") {
31227
+ runs.push(element);
31228
+ return;
31229
+ }
31230
+ if (element.name === "w:sdt") {
31231
+ const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
31232
+ if (sdtContent?.elements) {
31233
+ runs.push(...convertSdtContentToRuns(sdtContent.elements));
31234
+ }
31235
+ return;
31236
+ }
31237
+ if (RUN_LEVEL_WRAPPERS.has(element.name)) {
31238
+ const wrapperElements = convertSdtContentToRuns(element.elements || []);
31239
+ if (wrapperElements.length) {
31240
+ runs.push({
31241
+ ...element,
31242
+ elements: wrapperElements
31243
+ });
31244
+ }
31245
+ return;
31246
+ }
31247
+ if (element.name) {
31248
+ runs.push({
31249
+ name: "w:r",
31250
+ type: "element",
31251
+ elements: element.elements || [element]
31252
+ });
31253
+ }
31254
+ });
31255
+ return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
31256
+ }
31101
31257
  function translateStructuredContent(params2) {
31102
31258
  const { node, isFinalDoc } = params2;
31103
31259
  const childContent = translateChildNodes({ ...params2, node });
@@ -34345,7 +34501,6 @@ const config = {
34345
34501
  attributes: validXmlAttributes
34346
34502
  };
34347
34503
  const translator = NodeTranslator.from(config);
34348
- const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
34349
34504
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
34350
34505
  pageSize: Object.freeze({ width: "12240", height: "15840" }),
34351
34506
  pageMargins: Object.freeze({
@@ -34403,45 +34558,6 @@ const ensureSectionLayoutDefaults = (sectPr, converter) => {
34403
34558
  });
34404
34559
  return sectPr;
34405
34560
  };
34406
- function convertSdtContentToRuns(elements) {
34407
- const normalized = Array.isArray(elements) ? elements : [elements];
34408
- const runs = [];
34409
- normalized.forEach((element) => {
34410
- if (!element) return;
34411
- if (element.name === "w:sdtPr") {
34412
- return;
34413
- }
34414
- if (element.name === "w:r") {
34415
- runs.push(element);
34416
- return;
34417
- }
34418
- if (element.name === "w:sdt") {
34419
- const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
34420
- if (sdtContent?.elements) {
34421
- runs.push(...convertSdtContentToRuns(sdtContent.elements));
34422
- }
34423
- return;
34424
- }
34425
- if (RUN_LEVEL_WRAPPERS.has(element.name)) {
34426
- const wrapperElements = convertSdtContentToRuns(element.elements || []);
34427
- if (wrapperElements.length) {
34428
- runs.push({
34429
- ...element,
34430
- elements: wrapperElements
34431
- });
34432
- }
34433
- return;
34434
- }
34435
- if (element.name) {
34436
- runs.push({
34437
- name: "w:r",
34438
- type: "element",
34439
- elements: element.elements || [element]
34440
- });
34441
- }
34442
- });
34443
- return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
34444
- }
34445
34561
  function exportSchemaToJson(params2) {
34446
34562
  const { type: type2 } = params2.node || {};
34447
34563
  const router = {
@@ -34548,57 +34664,7 @@ function translateHeadingNode(params2) {
34548
34664
  // Maps to Heading1, Heading2, etc. in Word
34549
34665
  }
34550
34666
  };
34551
- return translateParagraphNode({ ...params2, node: paragraphNode });
34552
- }
34553
- function translateParagraphNode(params2) {
34554
- const elements = translateChildNodes(params2);
34555
- const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
34556
- if (htmlAnnotationChild) {
34557
- return htmlAnnotationChild.elements;
34558
- }
34559
- const pPr = generateParagraphProperties(params2);
34560
- if (pPr) elements.unshift(pPr);
34561
- let attributes = {};
34562
- if (params2.node.attrs?.rsidRDefault) {
34563
- attributes["w:rsidRDefault"] = params2.node.attrs.rsidRDefault;
34564
- }
34565
- const result = {
34566
- name: "w:p",
34567
- elements,
34568
- attributes
34569
- };
34570
- return result;
34571
- }
34572
- function generateParagraphProperties(params2) {
34573
- const { node } = params2;
34574
- const { attrs = {} } = node;
34575
- const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
34576
- if (attrs.styleId !== paragraphProperties.styleId) {
34577
- paragraphProperties.styleId = attrs.styleId;
34578
- }
34579
- ["borders", "styleId", "indent", "textAlign", "keepLines", "keepNext", "spacing", "tabStops"].forEach((key2) => {
34580
- let propKey = key2 === "textAlign" ? "justification" : key2;
34581
- if (JSON.stringify(paragraphProperties[propKey]) !== JSON.stringify(attrs[key2])) {
34582
- paragraphProperties[key2] = attrs[key2];
34583
- }
34584
- });
34585
- const framePr = attrs.dropcap;
34586
- if (framePr) {
34587
- framePr.dropCap = framePr.type;
34588
- delete framePr.type;
34589
- }
34590
- if (JSON.stringify(paragraphProperties.framePr) !== JSON.stringify(framePr)) {
34591
- paragraphProperties.framePr = framePr;
34592
- }
34593
- const marksProps = decodeRPrFromMarks(attrs.marksAttrs || []);
34594
- const finalRunProps = combineRunProperties([paragraphProperties.runProperties || {}, marksProps]);
34595
- paragraphProperties.runProperties = finalRunProps;
34596
- const pPr = translator$12.decode({ node: { ...node, attrs: { paragraphProperties } } });
34597
- const sectPr = node.attrs?.paragraphProperties?.sectPr;
34598
- if (sectPr) {
34599
- pPr.elements.push(sectPr);
34600
- }
34601
- return pPr;
34667
+ return translator$11.decode({ ...params2, node: paragraphNode });
34602
34668
  }
34603
34669
  function translateDocumentNode(params2) {
34604
34670
  const bodyNode = {
@@ -34613,59 +34679,6 @@ function translateDocumentNode(params2) {
34613
34679
  };
34614
34680
  return [node, params2];
34615
34681
  }
34616
- function getTextNodeForExport(text, marks, params2) {
34617
- const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
34618
- const space = hasLeadingOrTrailingSpace ? "preserve" : null;
34619
- const nodeAttrs = space ? { "xml:space": space } : null;
34620
- const textNodes = [];
34621
- const textRunProperties = decodeRPrFromMarks(marks || []);
34622
- const parentRunProperties = params2.extraParams?.runProperties || {};
34623
- const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
34624
- const rPrNode = translator$1N.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
34625
- textNodes.push({
34626
- name: "w:t",
34627
- elements: [{ text, type: "text" }],
34628
- attributes: nodeAttrs
34629
- });
34630
- if (params2) {
34631
- const { editor } = params2;
34632
- const customMarks = editor.extensionService.extensions.filter((e) => e.isExternal === true);
34633
- marks.forEach((mark) => {
34634
- const isCustomMark = customMarks.some((customMark) => {
34635
- const customMarkName = customMark.name;
34636
- return mark.type === customMarkName;
34637
- });
34638
- if (!isCustomMark) return;
34639
- let attrsString = "";
34640
- Object.entries(mark.attrs).forEach(([key2, value]) => {
34641
- if (value) {
34642
- attrsString += `${key2}=${value};`;
34643
- }
34644
- });
34645
- if (isCustomMark) {
34646
- textNodes.unshift({
34647
- type: "element",
34648
- name: "w:bookmarkStart",
34649
- attributes: {
34650
- "w:id": "5000",
34651
- "w:name": mark.type + ";" + attrsString
34652
- }
34653
- });
34654
- textNodes.push({
34655
- type: "element",
34656
- name: "w:bookmarkEnd",
34657
- attributes: {
34658
- "w:id": "5000"
34659
- }
34660
- });
34661
- }
34662
- });
34663
- }
34664
- return {
34665
- name: "w:r",
34666
- elements: rPrNode ? [rPrNode, ...textNodes] : textNodes
34667
- };
34668
- }
34669
34682
  function wrapTextInRun(nodeOrNodes, marks) {
34670
34683
  let elements = [];
34671
34684
  if (Array.isArray(nodeOrNodes)) elements = nodeOrNodes;
@@ -34694,60 +34707,6 @@ function processOutputMarks(marks = []) {
34694
34707
  }
34695
34708
  });
34696
34709
  }
34697
- function processLinkContentNode(node) {
34698
- if (!node) return node;
34699
- const contentNode = carbonCopy(node);
34700
- if (!contentNode) return contentNode;
34701
- const hyperlinkStyle = {
34702
- name: "w:rStyle",
34703
- attributes: { "w:val": "Hyperlink" }
34704
- };
34705
- const color = {
34706
- name: "w:color",
34707
- attributes: { "w:val": "467886" }
34708
- };
34709
- const underline = {
34710
- name: "w:u",
34711
- attributes: {
34712
- "w:val": "none"
34713
- }
34714
- };
34715
- if (contentNode.name === "w:r") {
34716
- const runProps = contentNode.elements.find((el) => el.name === "w:rPr");
34717
- if (runProps) {
34718
- const foundColor = runProps.elements.find((el) => el.name === "w:color");
34719
- const foundHyperlinkStyle = runProps.elements.find((el) => el.name === "w:rStyle");
34720
- const underlineMark = runProps.elements.find((el) => el.name === "w:u");
34721
- if (!foundColor) runProps.elements.unshift(color);
34722
- if (!foundHyperlinkStyle) runProps.elements.unshift(hyperlinkStyle);
34723
- if (!underlineMark) runProps.elements.unshift(underline);
34724
- } else {
34725
- const runProps2 = {
34726
- name: "w:rPr",
34727
- elements: [hyperlinkStyle, color]
34728
- };
34729
- contentNode.elements.unshift(runProps2);
34730
- }
34731
- }
34732
- return contentNode;
34733
- }
34734
- function addNewLinkRelationship(params2, link) {
34735
- const newId = "rId" + generateDocxRandomId();
34736
- if (!params2.relationships || !Array.isArray(params2.relationships)) {
34737
- params2.relationships = [];
34738
- }
34739
- params2.relationships.push({
34740
- type: "element",
34741
- name: "Relationship",
34742
- attributes: {
34743
- Id: newId,
34744
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
34745
- Target: link,
34746
- TargetMode: "External"
34747
- }
34748
- });
34749
- return newId;
34750
- }
34751
34710
  function translateMark(mark) {
34752
34711
  const xmlMark = SuperConverter.markTypes.find((m2) => m2.type === mark.type);
34753
34712
  if (!xmlMark) {
@@ -34928,7 +34887,7 @@ const prepareCommentParaIds = (comment) => {
34928
34887
  return newComment;
34929
34888
  };
34930
34889
  const getCommentDefinition = (comment, commentId, allComments, editor) => {
34931
- const translatedText = translateParagraphNode({ editor, node: comment.commentJSON });
34890
+ const translatedText = translator$11.decode({ editor, node: comment.commentJSON });
34932
34891
  const attributes = {
34933
34892
  "w:id": String(commentId),
34934
34893
  "w:author": comment.creatorName || comment.importedAuthor?.name,
@@ -35343,7 +35302,7 @@ const _SuperConverter = class _SuperConverter2 {
35343
35302
  static getStoredSuperdocVersion(docx) {
35344
35303
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35345
35304
  }
35346
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.4") {
35305
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.5") {
35347
35306
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35348
35307
  }
35349
35308
  /**
@@ -52603,7 +52562,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52603
52562
  { default: remarkStringify },
52604
52563
  { default: remarkGfm }
52605
52564
  ] = await Promise.all([
52606
- Promise.resolve().then(() => require("./index-BmNdb0G--CqIBE8k-.cjs")),
52565
+ Promise.resolve().then(() => require("./index-B7dC-H-Q-DfBEU7rR.cjs")),
52607
52566
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
52608
52567
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
52609
52568
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -52804,7 +52763,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
52804
52763
  * Process collaboration migrations
52805
52764
  */
52806
52765
  processCollaborationMigrations() {
52807
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.4");
52766
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.5");
52808
52767
  if (!this.options.ydoc) return;
52809
52768
  const metaMap = this.options.ydoc.getMap("meta");
52810
52769
  let docVersion = metaMap.get("version");