@harbour-enterprises/superdoc 1.0.0-beta.40 → 1.0.0-beta.54

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-B5MRM8r_.es.js → PdfViewer-D_U-y4Wi.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-IpSRU3o0.cjs → PdfViewer-qBKjClah.cjs} +1 -1
  3. package/dist/chunks/{index-B9PZ8RCF.cjs → index-BKvAeQdF.cjs} +3 -3
  4. package/dist/chunks/{index-Dx9W6Dsv-D4FIlgW4.cjs → index-t8thQIOL-CV8VTGI4.cjs} +1 -1
  5. package/dist/chunks/{index-Dx9W6Dsv-DbYj9Ur7.es.js → index-t8thQIOL-vW80ABaR.es.js} +1 -1
  6. package/dist/chunks/{index-CJeY9b_E.es.js → index-to6_YLa7.es.js} +3 -3
  7. package/dist/chunks/{super-editor.es-C7wUYMFI.cjs → super-editor.es-BMiadG4G.cjs} +510 -180
  8. package/dist/chunks/{super-editor.es-CGmPt3mY.es.js → super-editor.es-xpC1DWhM.es.js} +510 -180
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-D6IUdu7s.js → converter-OoT4LYwQ.js} +294 -79
  11. package/dist/super-editor/chunks/{docx-zipper-C1WNNxUr.js → docx-zipper-Cf_hIcjC.js} +15 -11
  12. package/dist/super-editor/chunks/{editor-DNmem5Gg.js → editor-CqbtudGQ.js} +204 -93
  13. package/dist/super-editor/chunks/{index-Dx9W6Dsv.js → index-t8thQIOL.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CHc2RUXU.js → toolbar-BsfRAJ0o.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 +512 -182
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -18025,7 +18025,7 @@ const attrConfig$r = Object.freeze({
18025
18025
  encode: encode$Q,
18026
18026
  decode: decode$S
18027
18027
  });
18028
- const validXmlAttributes$j = [attrConfig$s, attrConfig$r];
18028
+ const validXmlAttributes$h = [attrConfig$s, attrConfig$r];
18029
18029
  const XML_NODE_NAME$q = "w:br";
18030
18030
  const SD_NODE_NAME$k = "lineBreak";
18031
18031
  const encode$P = (_2, encodedAttrs) => {
@@ -18061,7 +18061,7 @@ const config$p = {
18061
18061
  type: NodeTranslator.translatorTypes.NODE,
18062
18062
  encode: encode$P,
18063
18063
  decode: decode$R,
18064
- attributes: validXmlAttributes$j
18064
+ attributes: validXmlAttributes$h
18065
18065
  };
18066
18066
  const translator$23 = NodeTranslator.from(config$p);
18067
18067
  const encode$O = (attributes) => attributes?.["w:val"];
@@ -18072,7 +18072,7 @@ const attrConfig$q = Object.freeze({
18072
18072
  encode: encode$O,
18073
18073
  decode: decode$Q
18074
18074
  });
18075
- const validXmlAttributes$i = [attrConfig$q];
18075
+ const validXmlAttributes$g = [attrConfig$q];
18076
18076
  const XML_NODE_NAME$p = "w:highlight";
18077
18077
  const SD_ATTR_KEY$4 = "highlight";
18078
18078
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
@@ -18123,7 +18123,7 @@ const config$o = {
18123
18123
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
18124
18124
  encode: encode$N,
18125
18125
  decode: decode$P,
18126
- attributes: validXmlAttributes$i
18126
+ attributes: validXmlAttributes$g
18127
18127
  };
18128
18128
  const translator$22 = NodeTranslator.from(config$o);
18129
18129
  const encode$M = (attributes) => {
@@ -18166,7 +18166,7 @@ const attrConfig$n = Object.freeze({
18166
18166
  encode: encode$K,
18167
18167
  decode: decode$M
18168
18168
  });
18169
- const validXmlAttributes$h = [attrConfig$p, attrConfig$n, attrConfig$o];
18169
+ const validXmlAttributes$f = [attrConfig$p, attrConfig$n, attrConfig$o];
18170
18170
  const XML_NODE_NAME$o = "w:tab";
18171
18171
  const SD_NODE_NAME$j = "tab";
18172
18172
  const encode$J = (_2, encodedAttrs = {}) => {
@@ -18202,7 +18202,7 @@ const config$n = {
18202
18202
  type: NodeTranslator.translatorTypes.NODE,
18203
18203
  encode: encode$J,
18204
18204
  decode: decode$L,
18205
- attributes: validXmlAttributes$h
18205
+ attributes: validXmlAttributes$f
18206
18206
  };
18207
18207
  const translator$21 = NodeTranslator.from(config$n);
18208
18208
  const carbonCopy = (obj) => {
@@ -18573,7 +18573,7 @@ const attrConfig$i = Object.freeze({
18573
18573
  encode: encode$E,
18574
18574
  decode: decode$G
18575
18575
  });
18576
- const validXmlAttributes$g = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
18576
+ const validXmlAttributes$e = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
18577
18577
  const XML_NODE_NAME$n = "w:u";
18578
18578
  const SD_ATTR_KEY$3 = "underline";
18579
18579
  const encode$D = (params2, encodedAttrs = {}) => {
@@ -18625,7 +18625,7 @@ const config$m = {
18625
18625
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
18626
18626
  encode: encode$D,
18627
18627
  decode: decode$F,
18628
- attributes: validXmlAttributes$g
18628
+ attributes: validXmlAttributes$e
18629
18629
  };
18630
18630
  const translator$1Z = NodeTranslator.from(config$m);
18631
18631
  const translator$1Y = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
@@ -18759,7 +18759,7 @@ const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
18759
18759
  ]);
18760
18760
  const XML_NODE_NAME$m = "mc:AlternateContent";
18761
18761
  const SD_NODE_NAME$i = [];
18762
- const validXmlAttributes$f = [];
18762
+ const validXmlAttributes$d = [];
18763
18763
  function encode$C(params2) {
18764
18764
  const { nodeListHandler } = params2;
18765
18765
  const { node } = params2.extraParams;
@@ -18799,7 +18799,7 @@ const config$l = {
18799
18799
  type: NodeTranslator.translatorTypes.NODE,
18800
18800
  encode: encode$C,
18801
18801
  decode: decode$E,
18802
- attributes: validXmlAttributes$f
18802
+ attributes: validXmlAttributes$d
18803
18803
  };
18804
18804
  function selectAlternateContentElements(node) {
18805
18805
  if (!node?.elements?.length) {
@@ -18939,7 +18939,7 @@ const createTrackStyleMark = (marks) => {
18939
18939
  };
18940
18940
  const XML_NODE_NAME$l = "w:ins";
18941
18941
  const SD_ATTR_KEY$2 = "trackInsert";
18942
- const validXmlAttributes$e = [
18942
+ const validXmlAttributes$c = [
18943
18943
  createAttributeHandler("w:id", "id"),
18944
18944
  createAttributeHandler("w:date", "date"),
18945
18945
  createAttributeHandler("w:author", "author"),
@@ -18999,7 +18999,7 @@ const config$k = {
18999
18999
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
19000
19000
  encode: encode$B,
19001
19001
  decode: decode$D,
19002
- attributes: validXmlAttributes$e
19002
+ attributes: validXmlAttributes$c
19003
19003
  };
19004
19004
  const translator$1w = NodeTranslator.from(config$k);
19005
19005
  const translator$1v = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
@@ -19193,11 +19193,12 @@ const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = fa
19193
19193
  }
19194
19194
  if (isListNumber) {
19195
19195
  let numberingProps = {};
19196
- if (resolvedPpr?.numberingProperties?.numId != null) {
19196
+ const numId = resolvedPpr?.numberingProperties?.numId;
19197
+ if (numId != null && numId !== 0 && numId !== "0") {
19197
19198
  numberingProps = getNumberingProperties(
19198
19199
  params2,
19199
19200
  resolvedPpr.numberingProperties.ilvl ?? 0,
19200
- resolvedPpr.numberingProperties.numId,
19201
+ numId,
19201
19202
  translator$1N
19202
19203
  );
19203
19204
  }
@@ -19235,9 +19236,13 @@ function resolveParagraphProperties(params2, inlineProps, insideTable = false, o
19235
19236
  let styleProps = inlineProps?.styleId ? resolveStyleChain$1(params2, inlineProps?.styleId, translator$12) : {};
19236
19237
  let numberingProps = {};
19237
19238
  let ilvl = inlineProps?.numberingProperties?.ilvl ?? styleProps?.numberingProperties?.ilvl;
19238
- const numId = inlineProps?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
19239
+ let numId = inlineProps?.numberingProperties?.numId ?? styleProps?.numberingProperties?.numId;
19239
19240
  let numberingDefinedInline = inlineProps?.numberingProperties?.numId != null;
19240
- const isList2 = numId != null;
19241
+ const inlineNumIdDisablesNumbering = inlineProps?.numberingProperties?.numId === 0 || inlineProps?.numberingProperties?.numId === "0";
19242
+ if (inlineNumIdDisablesNumbering) {
19243
+ numId = null;
19244
+ }
19245
+ const isList2 = numId != null && numId !== 0 && numId !== "0";
19241
19246
  if (isList2) {
19242
19247
  ilvl = ilvl != null ? ilvl : 0;
19243
19248
  numberingProps = getNumberingProperties(params2, ilvl, numId, translator$12);
@@ -20378,7 +20383,7 @@ const attrConfig$b = Object.freeze({
20378
20383
  encode: encode$u,
20379
20384
  decode: decode$w
20380
20385
  });
20381
- const validXmlAttributes$d = [
20386
+ const validXmlAttributes$b = [
20382
20387
  attrConfig$c,
20383
20388
  attrConfig$b,
20384
20389
  attrConfig$f,
@@ -20411,7 +20416,7 @@ const config$j = {
20411
20416
  type: NodeTranslator.translatorTypes.NODE,
20412
20417
  encode: encode$t,
20413
20418
  decode: decode$v,
20414
- attributes: validXmlAttributes$d
20419
+ attributes: validXmlAttributes$b
20415
20420
  };
20416
20421
  const translator$11 = NodeTranslator.from(config$j);
20417
20422
  const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
@@ -20594,7 +20599,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
20594
20599
  encode: (attributes) => attributes[xmlName],
20595
20600
  decode: (attributes) => attributes[sdName]
20596
20601
  });
20597
- const validXmlAttributes$c = [
20602
+ const validXmlAttributes$a = [
20598
20603
  _createAttributeHandler("w:anchor", "anchor"),
20599
20604
  _createAttributeHandler("w:docLocation", "docLocation"),
20600
20605
  {
@@ -20696,7 +20701,7 @@ const config$i = {
20696
20701
  type: NodeTranslator.translatorTypes.NODE,
20697
20702
  encode: encode$s,
20698
20703
  decode: decode$u,
20699
- attributes: validXmlAttributes$c
20704
+ attributes: validXmlAttributes$a
20700
20705
  };
20701
20706
  const translator$10 = NodeTranslator.from(config$i);
20702
20707
  const encode$r = (attributes) => {
@@ -20735,7 +20740,7 @@ const attrConfig$8 = Object.freeze({
20735
20740
  encode: encode$p,
20736
20741
  decode: decode$r
20737
20742
  });
20738
- const validXmlAttributes$b = [attrConfig$a, attrConfig$9, attrConfig$8];
20743
+ const validXmlAttributes$9 = [attrConfig$a, attrConfig$9, attrConfig$8];
20739
20744
  const XML_NODE_NAME$i = "w:r";
20740
20745
  const SD_KEY_NAME = "run";
20741
20746
  const encode$o = (params2, encodedAttrs = {}) => {
@@ -20882,7 +20887,7 @@ const config$h = {
20882
20887
  type: NodeTranslator.translatorTypes.NODE,
20883
20888
  encode: encode$o,
20884
20889
  decode: decode$q,
20885
- attributes: validXmlAttributes$b
20890
+ attributes: validXmlAttributes$9
20886
20891
  };
20887
20892
  const translator$$ = NodeTranslator.from(config$h);
20888
20893
  const translator$_ = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
@@ -21312,7 +21317,7 @@ function generateTableCellProperties(node) {
21312
21317
  }
21313
21318
  const XML_NODE_NAME$h = "w:tc";
21314
21319
  const SD_NODE_NAME$f = "tableCell";
21315
- const validXmlAttributes$a = [];
21320
+ const validXmlAttributes$8 = [];
21316
21321
  function encode$n(params2, encodedAttrs) {
21317
21322
  const {
21318
21323
  node,
@@ -21353,7 +21358,7 @@ const config$g = {
21353
21358
  type: NodeTranslator.translatorTypes.NODE,
21354
21359
  encode: encode$n,
21355
21360
  decode: decode$p,
21356
- attributes: validXmlAttributes$a
21361
+ attributes: validXmlAttributes$8
21357
21362
  };
21358
21363
  const translator$G = NodeTranslator.from(config$g);
21359
21364
  const translator$F = NodeTranslator.from({
@@ -21507,7 +21512,7 @@ const isPlaceholderCell = (cell) => {
21507
21512
  };
21508
21513
  const XML_NODE_NAME$g = "w:tr";
21509
21514
  const SD_NODE_NAME$e = "tableRow";
21510
- const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
21515
+ const validXmlAttributes$7 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
21511
21516
  (xmlName) => createAttributeHandler(xmlName)
21512
21517
  );
21513
21518
  const encode$m = (params2, encodedAttrs) => {
@@ -21644,7 +21649,7 @@ const config$f = {
21644
21649
  type: NodeTranslator.translatorTypes.NODE,
21645
21650
  encode: encode$m,
21646
21651
  decode: decode$o,
21647
- attributes: validXmlAttributes$9
21652
+ attributes: validXmlAttributes$7
21648
21653
  };
21649
21654
  const translator$v = NodeTranslator.from(config$f);
21650
21655
  function parseTagValueJSON(json) {
@@ -30423,6 +30428,7 @@ function handleImageNode$1(node, params2, isAnchor) {
30423
30428
  if (!node) return null;
30424
30429
  const { docx, filename, converter } = params2;
30425
30430
  const attributes = node?.attributes || {};
30431
+ const { order: order2, originalChildren } = collectPreservedDrawingChildren(node);
30426
30432
  const padding = {
30427
30433
  top: emuToPixels(attributes?.["distT"]),
30428
30434
  bottom: emuToPixels(attributes?.["distB"]),
@@ -30618,6 +30624,7 @@ function handleImageNode$1(node, params2, isAnchor) {
30618
30624
  }
30619
30625
  const wrapValue = wrap2;
30620
30626
  const nodeAttrs = {
30627
+ // originalXml: carbonCopy(node),
30621
30628
  src: finalSrc,
30622
30629
  alt: isMetafileExtension(extension) && !wasConverted ? "Unable to render EMF/WMF image" : docPr?.attributes?.name || "Image",
30623
30630
  extension: finalExtension,
@@ -30652,7 +30659,9 @@ function handleImageNode$1(node, params2, isAnchor) {
30652
30659
  distR: attributes["distR"]
30653
30660
  },
30654
30661
  originalAttributes: node.attributes,
30655
- rId: relAttributes["Id"]
30662
+ rId: relAttributes["Id"],
30663
+ ...order2.length ? { drawingChildOrder: order2 } : {},
30664
+ ...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
30656
30665
  };
30657
30666
  return {
30658
30667
  type: "image",
@@ -30677,6 +30686,23 @@ const handleShapeDrawing = (params2, node, graphicData, size2, padding, marginOf
30677
30686
  const fallbackType = textBoxContent ? "textbox" : "drawing";
30678
30687
  return buildShapePlaceholder(node, size2, padding, marginOffset, fallbackType);
30679
30688
  };
30689
+ function collectPreservedDrawingChildren(node) {
30690
+ const order2 = [];
30691
+ const original = [];
30692
+ if (!Array.isArray(node?.elements)) {
30693
+ return { order: order2, originalChildren: original };
30694
+ }
30695
+ node.elements.forEach((child, index2) => {
30696
+ if (!child) return;
30697
+ const name = child.name ?? null;
30698
+ order2.push(name);
30699
+ original.push({
30700
+ index: index2,
30701
+ xml: carbonCopy(child)
30702
+ });
30703
+ });
30704
+ return { order: order2, originalChildren: original };
30705
+ }
30680
30706
  const handleShapeGroup = (params2, node, graphicData, size2, padding, marginOffset, anchorData, wrap2) => {
30681
30707
  const wgp = graphicData.elements.find((el) => el.name === "wpg:wgp");
30682
30708
  if (!wgp) {
@@ -33445,7 +33471,7 @@ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, e
33445
33471
  }
33446
33472
  tr.setNodeMarkup(pos, null, newAttrs);
33447
33473
  }
33448
- const generateNewListDefinition = ({ numId, listType, level, start: start2, text, fmt, editor }) => {
33474
+ const generateNewListDefinition = ({ numId, listType, level, start: start2, text, fmt, editor, markerFontFamily }) => {
33449
33475
  if (typeof listType !== "string") listType = listType.name;
33450
33476
  const definition = listType === "orderedList" ? baseOrderedListDef : baseBulletList;
33451
33477
  const numbering = editor.converter.numbering;
@@ -33499,6 +33525,29 @@ const generateNewListDefinition = ({ numId, listType, level, start: start2, text
33499
33525
  }
33500
33526
  }
33501
33527
  ];
33528
+ if (markerFontFamily) {
33529
+ const rPrIndex = levelProps.elements.findIndex((el) => el.name === "w:rPr");
33530
+ let rPr = levelProps.elements[rPrIndex];
33531
+ if (!rPr) {
33532
+ rPr = {
33533
+ type: "element",
33534
+ name: "w:rPr",
33535
+ elements: []
33536
+ };
33537
+ levelProps.elements.push(rPr);
33538
+ }
33539
+ rPr.elements = rPr.elements.filter((el) => el.name !== "w:rFonts");
33540
+ rPr.elements.push({
33541
+ type: "element",
33542
+ name: "w:rFonts",
33543
+ attributes: {
33544
+ "w:ascii": markerFontFamily,
33545
+ "w:hAnsi": markerFontFamily,
33546
+ "w:eastAsia": markerFontFamily,
33547
+ "w:cs": markerFontFamily
33548
+ }
33549
+ });
33550
+ }
33502
33551
  }
33503
33552
  if (!skipAddingNewAbstract) newNumbering.abstracts[newAbstractId] = newAbstractDef;
33504
33553
  const newNumDef = getBasicNumIdTag(numId, newAbstractId);
@@ -33765,8 +33814,8 @@ const extractListLevelStyles = (cssText, listId, level, numId) => {
33765
33814
  }
33766
33815
  return styleMap;
33767
33816
  };
33768
- const extractParagraphStyles = (cssText, className) => {
33769
- const pattern = new RegExp(`\\.(${className})\\s*\\{([^}]+)\\}`, "i");
33817
+ const extractParagraphStyles = (cssText, selector) => {
33818
+ const pattern = new RegExp(`(${selector})\\s*\\{([^}]+)\\}`, "i");
33770
33819
  const match = cssText.match(pattern);
33771
33820
  if (!match) return null;
33772
33821
  const rawStyles = match[2].split(";").map((line) => line.trim()).filter(Boolean);
@@ -33881,7 +33930,7 @@ const handleDocxPaste = (html, editor, view) => {
33881
33930
  cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
33882
33931
  const tempDiv = document.createElement("div");
33883
33932
  tempDiv.innerHTML = cleanedHtml;
33884
- const data = tempDiv.querySelectorAll("p, li");
33933
+ const data = tempDiv.querySelectorAll("p, li, " + [1, 2, 3, 4, 5, 6, 7, 8, 9].map((n) => `h${n}`).join(", "));
33885
33934
  const startMap = {};
33886
33935
  data.forEach((item) => {
33887
33936
  let type2;
@@ -33893,13 +33942,24 @@ const handleDocxPaste = (html, editor, view) => {
33893
33942
  const styleAttr = item.getAttribute("style") || "";
33894
33943
  const msoListMatch = styleAttr.match(/mso-list:\s*l(\d+)\s+level(\d+)\s+lfo(\d+)/);
33895
33944
  const css = tempDiv.querySelector("style").innerHTML;
33896
- const normalStyles = extractParagraphStyles(css, "MsoNormal");
33897
- const paragraphStyles = extractParagraphStyles(css, item.getAttribute("class"));
33898
- let styleChain = { ...normalStyles, ...paragraphStyles };
33945
+ const normalStyles = extractParagraphStyles(css, ".MsoNormal");
33946
+ let styleId = item.getAttribute("class");
33947
+ let charStyles = {};
33948
+ if (item.localName.startsWith("h") && !styleId) {
33949
+ styleId = item.localName;
33950
+ const level = styleId.substring(1);
33951
+ charStyles = extractParagraphStyles(css, `.Heading${level}Char`);
33952
+ } else if (styleId) {
33953
+ styleId = `.${styleId}`;
33954
+ }
33955
+ const paragraphStyles = extractParagraphStyles(css, styleId);
33956
+ let styleChain = { ...normalStyles, ...paragraphStyles, ...charStyles };
33899
33957
  const numberingDefinedInline = !paragraphStyles || !paragraphStyles["mso-list"];
33900
33958
  if (msoListMatch) {
33901
33959
  const [, abstractId, level, numId] = msoListMatch;
33902
33960
  const numberingStyles = extractListLevelStyles(css, abstractId, level, numId) || {};
33961
+ const markerFontFamily = numberingStyles?.["font-family"] ?? normalStyles?.["font-family"];
33962
+ delete numberingStyles["font-family"];
33903
33963
  if (numberingDefinedInline) {
33904
33964
  styleChain = { ...normalStyles, ...paragraphStyles, ...numberingStyles };
33905
33965
  } else {
@@ -33922,6 +33982,7 @@ const handleDocxPaste = (html, editor, view) => {
33922
33982
  if (!startMap[numId]) startMap[numId] = startGetter(item.children[0]?.innerText || "1");
33923
33983
  start2 = startMap[numId];
33924
33984
  }
33985
+ item.setAttribute("data-marker-font-family", markerFontFamily);
33925
33986
  item.setAttribute("data-num-id", numId);
33926
33987
  item.setAttribute("data-list-level", parseInt(level) - 1);
33927
33988
  item.setAttribute("data-start", start2);
@@ -33970,6 +34031,24 @@ const handleDocxPaste = (html, editor, view) => {
33970
34031
  }
33971
34032
  });
33972
34033
  item.setAttribute("data-text-styles", JSON.stringify(textStyles));
34034
+ for (const child of item.children) {
34035
+ if (child.style) {
34036
+ Object.keys(textStyles).forEach((key2) => {
34037
+ const styleValue = textStyles[key2];
34038
+ if (styleValue) {
34039
+ child.style[key2] = styleValue;
34040
+ }
34041
+ });
34042
+ }
34043
+ }
34044
+ }
34045
+ if (resolvedStyle["font-weight"] === "bold") {
34046
+ item.style.fontWeight = "bold";
34047
+ for (const child of item.children) {
34048
+ if (child.style) {
34049
+ child.style.fontWeight = "bold";
34050
+ }
34051
+ }
33973
34052
  }
33974
34053
  extractAndRemoveConditionalPrefix(item);
33975
34054
  });
@@ -34013,6 +34092,7 @@ const transformWordLists = (container, editor) => {
34013
34092
  const numFmt = item.getAttribute("data-num-fmt");
34014
34093
  const start2 = item.getAttribute("data-start");
34015
34094
  const lvlText = item.getAttribute("data-lvl-text");
34095
+ const markerFontFamily = item.getAttribute("data-marker-font-family");
34016
34096
  const importedId = item.getAttribute("data-num-id");
34017
34097
  if (!mappedLists[importedId]) mappedLists[importedId] = ListHelpers.getNewListId(editor);
34018
34098
  const id = mappedLists[importedId];
@@ -34024,7 +34104,8 @@ const transformWordLists = (container, editor) => {
34024
34104
  start: start2,
34025
34105
  fmt: numFmt,
34026
34106
  text: lvlText,
34027
- editor
34107
+ editor,
34108
+ markerFontFamily
34028
34109
  });
34029
34110
  if (!lists[id]) lists[id] = { levels: {} };
34030
34111
  const currentListByNumId = lists[id];
@@ -34057,6 +34138,11 @@ const transformWordLists = (container, editor) => {
34057
34138
  const styleValue = textStyles[key2];
34058
34139
  if (styleValue) {
34059
34140
  pElement.style[key2] = styleValue;
34141
+ for (const child of pElement.children) {
34142
+ if (child.style) {
34143
+ child.style[key2] = styleValue;
34144
+ }
34145
+ }
34060
34146
  }
34061
34147
  });
34062
34148
  }
@@ -36390,11 +36476,71 @@ function translateShapeGroup(params2) {
36390
36476
  elements: []
36391
36477
  });
36392
36478
  }
36479
+ function mergeDrawingChildren({ order: order2, generated, original }) {
36480
+ const genQueues = groupByName(generated);
36481
+ const originalsByIndex = groupByIndex(original);
36482
+ return mergeWithOrder(order2, genQueues, originalsByIndex);
36483
+ }
36484
+ function groupByIndex(entries = []) {
36485
+ const map3 = /* @__PURE__ */ new Map();
36486
+ entries.forEach((entry) => {
36487
+ if (!entry) return;
36488
+ const { index: index2, xml } = entry;
36489
+ if (typeof index2 === "number" && xml && xml.name !== "wp:extent") {
36490
+ map3.set(index2, carbonCopy(xml));
36491
+ }
36492
+ });
36493
+ return map3;
36494
+ }
36495
+ function mergeWithOrder(order2 = [], genQueues, originalsByIndex) {
36496
+ const out = [];
36497
+ const namesInOrder = new Set(order2);
36498
+ order2.forEach((name, idx) => {
36499
+ if (name === "wp:extent") {
36500
+ const queue3 = genQueues.get("wp:extent") || [];
36501
+ if (queue3.length) {
36502
+ out.push(queue3.shift());
36503
+ if (!queue3.length) genQueues.delete("wp:extent");
36504
+ }
36505
+ return;
36506
+ }
36507
+ if (originalsByIndex.has(idx)) {
36508
+ out.push(originalsByIndex.get(idx));
36509
+ originalsByIndex.delete(idx);
36510
+ if (genQueues.has(name)) {
36511
+ genQueues.delete(name);
36512
+ }
36513
+ return;
36514
+ }
36515
+ const queue2 = genQueues.get(name) || [];
36516
+ if (queue2.length) {
36517
+ out.push(queue2.shift());
36518
+ if (!queue2.length) genQueues.delete(name);
36519
+ }
36520
+ });
36521
+ originalsByIndex.forEach((xml) => out.push(xml));
36522
+ genQueues.forEach((queue2, name) => {
36523
+ if (namesInOrder.has(name)) return;
36524
+ queue2.forEach((el) => out.push(el));
36525
+ });
36526
+ return out;
36527
+ }
36528
+ function groupByName(nodes = []) {
36529
+ const map3 = /* @__PURE__ */ new Map();
36530
+ nodes.forEach((el) => {
36531
+ if (!el?.name) return;
36532
+ const list = map3.get(el.name) || [];
36533
+ list.push(carbonCopy(el));
36534
+ map3.set(el.name, list);
36535
+ });
36536
+ return map3;
36537
+ }
36393
36538
  function translateAnchorNode(params2) {
36394
36539
  const { attrs } = params2.node;
36395
36540
  const anchorElements = [];
36396
- const hasSimplePos = attrs.simplePos || attrs.originalAttributes?.simplePos;
36397
- if (hasSimplePos) {
36541
+ const useOriginalChildren = Array.isArray(attrs.originalDrawingChildren) && attrs.originalDrawingChildren.length > 0;
36542
+ const hasSimplePos = attrs.simplePos !== void 0 || attrs.originalAttributes?.simplePos !== void 0;
36543
+ if (!useOriginalChildren && hasSimplePos) {
36398
36544
  anchorElements.push({
36399
36545
  name: "wp:simplePos",
36400
36546
  attributes: {
@@ -36403,7 +36549,7 @@ function translateAnchorNode(params2) {
36403
36549
  }
36404
36550
  });
36405
36551
  }
36406
- if (attrs.anchorData) {
36552
+ if (!useOriginalChildren && attrs.anchorData) {
36407
36553
  const hElements = [];
36408
36554
  if (attrs.marginOffset.horizontal !== void 0) {
36409
36555
  hElements.push({
@@ -36449,25 +36595,14 @@ function translateAnchorNode(params2) {
36449
36595
  if (inlineAttrs.relativeHeight == null) {
36450
36596
  inlineAttrs.relativeHeight = 1;
36451
36597
  }
36452
- if (attrs.originalAttributes?.simplePos !== void 0) {
36453
- inlineAttrs.simplePos = attrs.originalAttributes.simplePos;
36454
- } else if (hasSimplePos) {
36598
+ if (attrs.originalAttributes?.simplePos === void 0 && hasSimplePos) {
36455
36599
  inlineAttrs.simplePos = "1";
36456
36600
  }
36457
- if (attrs.originalAttributes?.locked !== void 0) {
36458
- inlineAttrs.locked = attrs.originalAttributes.locked;
36459
- }
36460
- if (attrs.originalAttributes?.layoutInCell !== void 0) {
36461
- inlineAttrs.layoutInCell = attrs.originalAttributes.layoutInCell;
36462
- }
36463
- if (attrs.originalAttributes?.allowOverlap !== void 0) {
36464
- inlineAttrs.allowOverlap = attrs.originalAttributes.allowOverlap;
36465
- }
36466
36601
  const wrapElement = {
36467
36602
  name: `wp:wrap${attrs.wrap?.type || "None"}`
36468
36603
  // Important: wp:anchor will break if no wrapping is specified. We need to use wrapNone.
36469
36604
  };
36470
- switch (attrs.wrap?.type) {
36605
+ switch (useOriginalChildren ? void 0 : attrs.wrap?.type) {
36471
36606
  case "Square":
36472
36607
  wrapElement.attributes = {
36473
36608
  wrapText: attrs.wrap.attrs.wrapText
@@ -36547,15 +36682,33 @@ function translateAnchorNode(params2) {
36547
36682
  wrapElement,
36548
36683
  ...nodeElements.elements.slice(effectIndex + 1)
36549
36684
  ];
36685
+ const mergedElements = mergeDrawingChildren({
36686
+ order: attrs.drawingChildOrder || [],
36687
+ original: attrs.originalDrawingChildren || [],
36688
+ generated: [...anchorElements, ...elementsWithWrap]
36689
+ });
36550
36690
  return {
36551
36691
  name: "wp:anchor",
36552
36692
  attributes: inlineAttrs,
36553
- elements: [...anchorElements, ...elementsWithWrap]
36693
+ elements: mergedElements
36554
36694
  };
36555
36695
  }
36556
36696
  const XML_NODE_NAME$f = "wp:anchor";
36557
36697
  const SD_NODE_NAME$d = ["image", "shapeGroup", "vectorShape", "contentBlock"];
36558
- const validXmlAttributes$8 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
36698
+ const validXmlAttributes$6 = [
36699
+ "distT",
36700
+ "distB",
36701
+ "distL",
36702
+ "distR",
36703
+ "allowOverlap",
36704
+ "behindDoc",
36705
+ "layoutInCell",
36706
+ "locked",
36707
+ "relativeHeight",
36708
+ "simplePos",
36709
+ "wp14:anchorId",
36710
+ "wp14:editId"
36711
+ ].map((xmlName) => createAttributeHandler(xmlName));
36559
36712
  function encode$l(params2) {
36560
36713
  const { node } = params2.extraParams;
36561
36714
  if (!node || !node.name) {
@@ -36576,7 +36729,7 @@ const config$e = {
36576
36729
  type: NodeTranslator.translatorTypes.NODE,
36577
36730
  encode: encode$l,
36578
36731
  decode: decode$n,
36579
- attributes: validXmlAttributes$8
36732
+ attributes: validXmlAttributes$6
36580
36733
  };
36581
36734
  const translator$u = NodeTranslator.from(config$e);
36582
36735
  function handleInlineNode(params2) {
@@ -36587,16 +36740,29 @@ function handleInlineNode(params2) {
36587
36740
  return handleImageNode$1(node, params2, false);
36588
36741
  }
36589
36742
  function translateInlineNode(params2) {
36743
+ const { attrs } = params2.node;
36590
36744
  const nodeElements = translateImageNode(params2);
36745
+ const inlineAttrs = {
36746
+ ...attrs.originalAttributes || {},
36747
+ ...nodeElements.attributes || {}
36748
+ };
36749
+ const generatedElements = nodeElements?.elements || [];
36750
+ const mergedElements = mergeDrawingChildren({
36751
+ order: params2.node?.attrs?.drawingChildOrder || [],
36752
+ original: params2.node?.attrs?.originalDrawingChildren || [],
36753
+ generated: generatedElements
36754
+ });
36591
36755
  return {
36592
36756
  name: "wp:inline",
36593
- attributes: nodeElements.attributes,
36594
- elements: nodeElements.elements
36757
+ attributes: inlineAttrs,
36758
+ elements: mergedElements
36595
36759
  };
36596
36760
  }
36597
36761
  const XML_NODE_NAME$e = "wp:inline";
36598
36762
  const SD_NODE_NAME$c = ["image", "shapeGroup", "vectorShape", "contentBlock"];
36599
- const validXmlAttributes$7 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
36763
+ const validXmlAttributes$5 = ["distT", "distB", "distL", "distR", "wp14:anchorId", "wp14:editId"].map(
36764
+ (xmlName) => createAttributeHandler(xmlName)
36765
+ );
36600
36766
  function encode$k(params2) {
36601
36767
  const { node } = params2.extraParams;
36602
36768
  if (!node || !node.name) {
@@ -36617,12 +36783,12 @@ const config$d = {
36617
36783
  type: NodeTranslator.translatorTypes.NODE,
36618
36784
  encode: encode$k,
36619
36785
  decode: decode$m,
36620
- attributes: validXmlAttributes$7
36786
+ attributes: validXmlAttributes$5
36621
36787
  };
36622
36788
  const translator$t = NodeTranslator.from(config$d);
36623
36789
  const XML_NODE_NAME$d = "w:drawing";
36624
36790
  const SD_NODE_NAME$b = [];
36625
- const validXmlAttributes$6 = [];
36791
+ const validXmlAttributes$4 = [];
36626
36792
  function encode$j(params2) {
36627
36793
  const nodes = params2.nodes;
36628
36794
  const node = nodes[0];
@@ -36630,14 +36796,21 @@ function encode$j(params2) {
36630
36796
  "wp:anchor": translator$u,
36631
36797
  "wp:inline": translator$t
36632
36798
  };
36633
- const result = node.elements.reduce((acc, child) => {
36799
+ const result = (node.elements || []).reduce((acc, child) => {
36634
36800
  if (acc) return acc;
36635
36801
  const translator2 = translatorByChildName[child.name];
36636
36802
  if (!translator2) return acc;
36637
36803
  const childResult = translator2.encode({ ...params2, extraParams: { node: child } });
36638
36804
  return childResult || acc;
36639
36805
  }, null);
36640
- return result;
36806
+ if (result) return result;
36807
+ return {
36808
+ type: "passthroughBlock",
36809
+ attrs: {
36810
+ originalName: "w:drawing",
36811
+ originalXml: carbonCopy(node)
36812
+ }
36813
+ };
36641
36814
  }
36642
36815
  function decode$l(params2) {
36643
36816
  const { node } = params2;
@@ -36660,7 +36833,7 @@ const config$c = {
36660
36833
  type: NodeTranslator.translatorTypes.NODE,
36661
36834
  encode: encode$j,
36662
36835
  decode: decode$l,
36663
- attributes: validXmlAttributes$6
36836
+ attributes: validXmlAttributes$4
36664
36837
  };
36665
36838
  const translator$s = NodeTranslator.from(config$c);
36666
36839
  function getTextNodeForExport(text, marks, params2) {
@@ -37491,7 +37664,7 @@ function generateSdtPrTagForStructuredContent({ node }) {
37491
37664
  }
37492
37665
  const XML_NODE_NAME$c = "w:sdt";
37493
37666
  const SD_NODE_NAME$a = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
37494
- const validXmlAttributes$5 = [];
37667
+ const validXmlAttributes$3 = [];
37495
37668
  function encode$i(params2) {
37496
37669
  const nodes = params2.nodes;
37497
37670
  const node = nodes[0];
@@ -37526,7 +37699,7 @@ const config$b = {
37526
37699
  type: NodeTranslator.translatorTypes.NODE,
37527
37700
  encode: encode$i,
37528
37701
  decode: decode$k,
37529
- attributes: validXmlAttributes$5
37702
+ attributes: validXmlAttributes$3
37530
37703
  };
37531
37704
  const translator$r = NodeTranslator.from(config$b);
37532
37705
  function preProcessVerticalMergeCells(table, { editorSchema }) {
@@ -38161,7 +38334,7 @@ const attrConfig$3 = Object.freeze({
38161
38334
  encode: encode$b,
38162
38335
  decode: decode$d
38163
38336
  });
38164
- const validXmlAttributes$4 = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
38337
+ const bookmarkStartAttrConfigs = [attrConfig$7, attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3];
38165
38338
  const XML_NODE_NAME$9 = "w:bookmarkStart";
38166
38339
  const SD_NODE_NAME$8 = "bookmarkStart";
38167
38340
  const encode$a = (params2, encodedAttrs = {}) => {
@@ -38186,7 +38359,7 @@ const config$8 = {
38186
38359
  type: NodeTranslator.translatorTypes.NODE,
38187
38360
  encode: encode$a,
38188
38361
  decode: decode$c,
38189
- attributes: validXmlAttributes$4
38362
+ attributes: bookmarkStartAttrConfigs
38190
38363
  };
38191
38364
  const translator$8 = NodeTranslator.from(config$8);
38192
38365
  const encode$9 = (attributes) => {
@@ -38213,7 +38386,7 @@ const attrConfig$1 = Object.freeze({
38213
38386
  encode: encode$8,
38214
38387
  decode: decode$a
38215
38388
  });
38216
- const validXmlAttributes$3 = [attrConfig$2, attrConfig$1];
38389
+ const bookmarkEndAttrConfigs = [attrConfig$2, attrConfig$1];
38217
38390
  const XML_NODE_NAME$8 = "w:bookmarkEnd";
38218
38391
  const SD_NODE_NAME$7 = "bookmarkEnd";
38219
38392
  const encode$7 = (params2, encodedAttrs = {}) => {
@@ -38238,7 +38411,7 @@ const config$7 = {
38238
38411
  type: NodeTranslator.translatorTypes.NODE,
38239
38412
  encode: encode$7,
38240
38413
  decode: decode$9,
38241
- attributes: validXmlAttributes$3
38414
+ attributes: bookmarkEndAttrConfigs
38242
38415
  };
38243
38416
  const translator$7 = NodeTranslator.from(config$7);
38244
38417
  const decode$8 = (attrs) => attrs?.["w:id"];
@@ -39204,7 +39377,8 @@ const INLINE_NODE_NAMES = /* @__PURE__ */ new Set([
39204
39377
  ]);
39205
39378
  const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:body", "w:tbl", "w:tc", "w:tr"]);
39206
39379
  const isInlineContext = (path = [], currentNodeName) => {
39207
- if (currentNodeName && INLINE_NODE_NAMES.has(currentNodeName)) {
39380
+ const immediateName = currentNodeName ?? path[path.length - 1]?.name;
39381
+ if (immediateName && INLINE_NODE_NAMES.has(immediateName)) {
39208
39382
  return true;
39209
39383
  }
39210
39384
  if (!Array.isArray(path) || path.length === 0) return false;
@@ -40067,27 +40241,28 @@ const preProcessNodesForFldChar = (nodes = [], docx) => {
40067
40241
  const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
40068
40242
  const fldType = fldCharEl?.attributes?.["w:fldCharType"];
40069
40243
  const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
40244
+ const rawNode = carbonCopy(node);
40070
40245
  collecting = collectedNodesStack.length > 0;
40071
40246
  if (fldType === "begin") {
40072
40247
  collectedNodesStack.push([]);
40073
- rawCollectedNodesStack.push([node]);
40248
+ rawCollectedNodesStack.push([rawNode]);
40074
40249
  currentFieldStack.push({ instrText: "" });
40075
40250
  continue;
40076
40251
  }
40077
40252
  if (instrTextEl && collecting && currentFieldStack.length > 0) {
40078
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node);
40253
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40079
40254
  currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
40080
40255
  continue;
40081
40256
  }
40082
40257
  if (fldType === "end") {
40083
40258
  if (collecting) {
40084
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node);
40259
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40085
40260
  }
40086
40261
  finalizeField();
40087
40262
  continue;
40088
40263
  } else if (fldType === "separate") {
40089
40264
  if (collecting) {
40090
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node);
40265
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40091
40266
  }
40092
40267
  continue;
40093
40268
  }
@@ -40098,21 +40273,21 @@ const preProcessNodesForFldChar = (nodes = [], docx) => {
40098
40273
  childResult.unpairedBegin.forEach((pendingField) => {
40099
40274
  currentFieldStack.push(pendingField.fieldInfo);
40100
40275
  collectedNodesStack.push([node]);
40101
- rawCollectedNodesStack.push([node]);
40276
+ rawCollectedNodesStack.push([rawNode]);
40102
40277
  });
40103
40278
  } else if (childResult.unpairedEnd) {
40104
40279
  collectedNodesStack[collectedNodesStack.length - 1].push(node);
40105
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node);
40280
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40106
40281
  finalizeField();
40107
40282
  } else if (collecting) {
40108
40283
  collectedNodesStack[collectedNodesStack.length - 1].push(node);
40109
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node);
40284
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40110
40285
  } else {
40111
40286
  processedNodes.push(node);
40112
40287
  }
40113
40288
  } else if (collecting) {
40114
40289
  collectedNodesStack[collectedNodesStack.length - 1].push(node);
40115
- rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(node);
40290
+ rawCollectedNodesStack[rawCollectedNodesStack.length - 1].push(rawNode);
40116
40291
  } else {
40117
40292
  processedNodes.push(node);
40118
40293
  }
@@ -40717,8 +40892,48 @@ function filterOutRootInlineNodes(content = []) {
40717
40892
  "commentReference",
40718
40893
  "structuredContent"
40719
40894
  ]);
40720
- return content.filter((node) => node && typeof node.type === "string" && !INLINE_TYPES.has(node.type));
40895
+ const PRESERVABLE_INLINE_XML_NAMES = {
40896
+ bookmarkStart: "w:bookmarkStart",
40897
+ bookmarkEnd: "w:bookmarkEnd"
40898
+ };
40899
+ const result = [];
40900
+ content.forEach((node) => {
40901
+ if (!node || typeof node.type !== "string") return;
40902
+ const type2 = node.type;
40903
+ const preservableNodeName = PRESERVABLE_INLINE_XML_NAMES[type2];
40904
+ if (!INLINE_TYPES.has(type2)) {
40905
+ result.push(node);
40906
+ } else if (preservableNodeName) {
40907
+ const originalXml = buildOriginalXml(type2, node.attrs, PRESERVABLE_INLINE_XML_NAMES);
40908
+ result.push({
40909
+ type: "passthroughBlock",
40910
+ attrs: {
40911
+ originalName: preservableNodeName,
40912
+ ...originalXml ? { originalXml } : {}
40913
+ }
40914
+ });
40915
+ }
40916
+ });
40917
+ return result;
40721
40918
  }
40919
+ const buildOriginalXml = (type2, attrs, preservableTags) => {
40920
+ const attrConfigsByType = {
40921
+ bookmarkStart: bookmarkStartAttrConfigs,
40922
+ bookmarkEnd: bookmarkEndAttrConfigs
40923
+ };
40924
+ const configs = attrConfigsByType[type2];
40925
+ if (!configs) return null;
40926
+ const xmlAttrs = {};
40927
+ configs.forEach((cfg) => {
40928
+ const val = cfg.decode(attrs || {});
40929
+ if (val !== void 0) {
40930
+ xmlAttrs[cfg.xmlName] = val;
40931
+ }
40932
+ });
40933
+ const attributes = Object.keys(xmlAttrs).length ? xmlAttrs : void 0;
40934
+ const name = preservableTags[type2];
40935
+ return { name, ...attributes ? { attributes } : {}, elements: [] };
40936
+ };
40722
40937
  function collapseWhitespaceNextToInlinePassthrough(content = []) {
40723
40938
  if (!Array.isArray(content) || content.length === 0) return;
40724
40939
  const sequence = collectInlineSequence(content);
@@ -41850,7 +42065,7 @@ const _SuperConverter = class _SuperConverter2 {
41850
42065
  static getStoredSuperdocVersion(docx) {
41851
42066
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41852
42067
  }
41853
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.40") {
42068
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.54") {
41854
42069
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41855
42070
  }
41856
42071
  /**
@@ -44923,19 +45138,24 @@ class DocxZipper {
44923
45138
  const u8 = await zipEntry.async("uint8array");
44924
45139
  const content = ensureXmlString(u8);
44925
45140
  this.files.push({ name, content });
44926
- } else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/") {
45141
+ } else if (name.startsWith("word/media") && name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/" || name.startsWith("media") && name !== "media/" || name.startsWith("word/embeddings") && name !== "word/embeddings/") {
44927
45142
  if (isNode2) {
44928
45143
  const buffer2 = await zipEntry.async("nodebuffer");
44929
45144
  const fileBase64 = buffer2.toString("base64");
44930
45145
  this.mediaFiles[name] = fileBase64;
44931
45146
  } else {
44932
- const blob = await zipEntry.async("blob");
44933
- const extension = this.getFileExtension(name);
44934
45147
  const fileBase64 = await zipEntry.async("base64");
44935
- this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
44936
- const fileObj = new File([blob], name, { type: blob.type });
44937
- const imageUrl = URL.createObjectURL(fileObj);
44938
- this.media[name] = imageUrl;
45148
+ const extension = this.getFileExtension(name)?.toLowerCase();
45149
+ const imageTypes = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "emf", "wmf", "svg", "webp"]);
45150
+ if (imageTypes.has(extension)) {
45151
+ this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
45152
+ const blob = await zipEntry.async("blob");
45153
+ const fileObj = new File([blob], name, { type: blob.type });
45154
+ const imageUrl = URL.createObjectURL(fileObj);
45155
+ this.media[name] = imageUrl;
45156
+ } else {
45157
+ this.mediaFiles[name] = fileBase64;
45158
+ }
44939
45159
  }
44940
45160
  } else if (name.startsWith("word/fonts") && name !== "word/fonts/") {
44941
45161
  const uint8array = await zipEntry.async("uint8array");
@@ -44954,9 +45174,8 @@ class DocxZipper {
44954
45174
  */
44955
45175
  async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
44956
45176
  const additionalPartNames = Object.keys(updatedDocs || {});
44957
- const newMediaTypes = Object.keys(media).map((name) => {
44958
- return this.getFileExtension(name);
44959
- }).filter(Boolean);
45177
+ const imageExts = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "bmp", "tiff", "emf", "wmf", "svg", "webp"]);
45178
+ const newMediaTypes = Object.keys(media).map((name) => this.getFileExtension(name)).filter((ext) => ext && imageExts.has(ext));
44960
45179
  const contentTypesPath = "[Content_Types].xml";
44961
45180
  let contentTypesXml;
44962
45181
  if (fromJson) {
@@ -59028,7 +59247,7 @@ const isHeadless = (editor) => {
59028
59247
  const shouldSkipNodeView = (editor) => {
59029
59248
  return isHeadless(editor);
59030
59249
  };
59031
- const summaryVersion = "1.0.0-beta.40";
59250
+ const summaryVersion = "1.0.0-beta.54";
59032
59251
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59033
59252
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59034
59253
  function mapAttributes(attrs) {
@@ -59817,7 +60036,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
59817
60036
  { default: remarkStringify },
59818
60037
  { default: remarkGfm }
59819
60038
  ] = await Promise.all([
59820
- import("./index-Dx9W6Dsv-DbYj9Ur7.es.js"),
60039
+ import("./index-t8thQIOL-vW80ABaR.es.js"),
59821
60040
  import("./index-DRCvimau-Cw339678.es.js"),
59822
60041
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
59823
60042
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60022,7 +60241,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60022
60241
  * Process collaboration migrations
60023
60242
  */
60024
60243
  processCollaborationMigrations() {
60025
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.40");
60244
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.54");
60026
60245
  if (!this.options.ydoc) return;
60027
60246
  const metaMap = this.options.ydoc.getMap("meta");
60028
60247
  let docVersion = metaMap.get("version");
@@ -62481,8 +62700,8 @@ const indentPtToPx = (indent) => {
62481
62700
  const hanging = ptToPx(indent.hanging);
62482
62701
  if (left2 != null && left2 !== 0) result.left = left2;
62483
62702
  if (right2 != null && right2 !== 0) result.right = right2;
62484
- if (firstLine != null && firstLine !== 0) result.firstLine = firstLine;
62485
- if (hanging != null && hanging !== 0) result.hanging = hanging;
62703
+ if (firstLine != null) result.firstLine = firstLine;
62704
+ if (hanging != null) result.hanging = hanging;
62486
62705
  return Object.keys(result).length > 0 ? result : void 0;
62487
62706
  };
62488
62707
  const normalizeAlignment = (value) => {
@@ -62569,7 +62788,7 @@ const normalizePxIndent = (value) => {
62569
62788
  }
62570
62789
  });
62571
62790
  if (!values.length) return void 0;
62572
- const looksLikeTwips = values.some((val) => val >= 50 || Math.abs(val % 15) < 1e-6);
62791
+ const looksLikeTwips = values.some((val) => val >= 50 || val !== 0 && Math.abs(val % 15) < 1e-6);
62573
62792
  if (looksLikeTwips) {
62574
62793
  return void 0;
62575
62794
  }
@@ -63454,6 +63673,7 @@ function computeWordParagraphLayout(input) {
63454
63673
  const firstLinePx = indent.firstLine;
63455
63674
  const defaultTabIntervalPx = resolveDefaultTabIntervalPx(paragraph.tabIntervalTwips, docDefaults);
63456
63675
  const tabsPx = tabs.map((tab) => tab.position);
63676
+ const hasFirstLineIndent = indent.firstLine != null && Number.isFinite(indent.firstLine) && indent.firstLine > 0 && !indent.hanging;
63457
63677
  const layout = {
63458
63678
  indentLeftPx,
63459
63679
  hangingPx: Math.max(hangingPxRaw, 0),
@@ -63477,9 +63697,19 @@ function computeWordParagraphLayout(input) {
63477
63697
  });
63478
63698
  const markerText = numbering.markerText ?? formatMarkerText(numbering);
63479
63699
  const glyphWidthPx = measurement?.measureText && markerText ? measurement.measureText(markerText, buildFontCss(markerRun), { letterSpacing: markerRun.letterSpacing }) : void 0;
63480
- const markerBoxWidthPx = resolveMarkerBoxWidth(hangingPxRaw, glyphWidthPx);
63481
- const markerX = indentLeftPx - markerBoxWidthPx;
63482
- layout.hangingPx = markerBoxWidthPx;
63700
+ let markerBoxWidthPx;
63701
+ let markerX;
63702
+ if (hasFirstLineIndent) {
63703
+ markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$2 : DEFAULT_LIST_HANGING_PX$1;
63704
+ markerX = indentLeftPx + (firstLinePx ?? 0);
63705
+ layout.textStartPx = markerX + markerBoxWidthPx;
63706
+ layout.hangingPx = 0;
63707
+ layout.firstLineIndentMode = true;
63708
+ } else {
63709
+ markerBoxWidthPx = resolveMarkerBoxWidth(hangingPxRaw, glyphWidthPx);
63710
+ markerX = indentLeftPx - markerBoxWidthPx;
63711
+ layout.hangingPx = markerBoxWidthPx;
63712
+ }
63483
63713
  layout.marker = buildMarkerLayout({
63484
63714
  numbering,
63485
63715
  markerText,
@@ -64071,6 +64301,9 @@ const cloneIfObject = (value) => {
64071
64301
  };
64072
64302
  const { resolveSpacingIndent } = Engines;
64073
64303
  const DEFAULT_DECIMAL_SEPARATOR$2 = ".";
64304
+ const isValidNumberingId = (numId) => {
64305
+ return numId != null && numId !== 0 && numId !== "0";
64306
+ };
64074
64307
  const asOoxmlElement = (value) => {
64075
64308
  if (!value || typeof value !== "object") return void 0;
64076
64309
  const element = value;
@@ -64563,9 +64796,10 @@ const computeWordLayoutForParagraph = (paragraphAttrs, numberingProps, styleCont
64563
64796
  let effectiveIndent = paragraphAttrs.indent;
64564
64797
  if (numberingProps?.resolvedLevelIndent) {
64565
64798
  const resolvedIndentPx = convertIndentTwipsToPx(numberingProps.resolvedLevelIndent);
64799
+ const numberingIndent = resolvedIndentPx ?? numberingProps.resolvedLevelIndent;
64566
64800
  effectiveIndent = {
64567
- ...paragraphAttrs.indent,
64568
- ...resolvedIndentPx ?? numberingProps.resolvedLevelIndent
64801
+ ...numberingIndent,
64802
+ ...paragraphAttrs.indent
64569
64803
  };
64570
64804
  }
64571
64805
  const resolvedTabs = toResolvedTabStops(paragraphAttrs.tabs);
@@ -64727,11 +64961,6 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
64727
64961
  } else if (computed2.paragraph.alignment) {
64728
64962
  paragraphAttrs.alignment = computed2.paragraph.alignment;
64729
64963
  }
64730
- const isJustified = paragraphAttrs.alignment === "justify";
64731
- const hasFirstLineIndent = normalizedIndent?.firstLine && normalizedIndent.firstLine > 0;
64732
- if (isJustified && hasFirstLineIndent) {
64733
- paragraphAttrs.suppressFirstLineIndent = true;
64734
- }
64735
64964
  const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
64736
64965
  if (spacingPx) paragraphAttrs.spacing = spacingPx;
64737
64966
  if (normalizedSpacing?.beforeAutospacing != null || normalizedSpacing?.afterAutospacing != null) {
@@ -64870,7 +65099,8 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
64870
65099
  }
64871
65100
  const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
64872
65101
  const rawNumberingProps = toAdapterNumberingProps(numberingSource);
64873
- if (rawNumberingProps) {
65102
+ const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
65103
+ if (hasValidNumbering) {
64874
65104
  const numberingProps = rawNumberingProps;
64875
65105
  const numId = numberingProps.numId;
64876
65106
  const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
@@ -71168,6 +71398,50 @@ function assertFragmentPmPositions(fragment, _context) {
71168
71398
  const hasPmEnd = fragment.pmEnd != null;
71169
71399
  globalValidationStats.record(hasPmStart, hasPmEnd);
71170
71400
  }
71401
+ function isMinimalWordLayout(value) {
71402
+ if (typeof value !== "object" || value === null) {
71403
+ return false;
71404
+ }
71405
+ const obj = value;
71406
+ if (obj.marker !== void 0) {
71407
+ if (typeof obj.marker !== "object" || obj.marker === null) {
71408
+ return false;
71409
+ }
71410
+ const marker = obj.marker;
71411
+ if (marker.markerX !== void 0 && typeof marker.markerX !== "number") {
71412
+ return false;
71413
+ }
71414
+ if (marker.textStartX !== void 0 && typeof marker.textStartX !== "number") {
71415
+ return false;
71416
+ }
71417
+ }
71418
+ if (obj.indentLeftPx !== void 0) {
71419
+ if (typeof obj.indentLeftPx !== "number") {
71420
+ return false;
71421
+ }
71422
+ }
71423
+ if (obj.firstLineIndentMode !== void 0) {
71424
+ if (typeof obj.firstLineIndentMode !== "boolean") {
71425
+ return false;
71426
+ }
71427
+ }
71428
+ if (obj.textStartPx !== void 0) {
71429
+ if (typeof obj.textStartPx !== "number") {
71430
+ return false;
71431
+ }
71432
+ }
71433
+ if (obj.tabsPx !== void 0) {
71434
+ if (!Array.isArray(obj.tabsPx)) {
71435
+ return false;
71436
+ }
71437
+ for (const tab of obj.tabsPx) {
71438
+ if (typeof tab !== "number") {
71439
+ return false;
71440
+ }
71441
+ }
71442
+ }
71443
+ return true;
71444
+ }
71171
71445
  const LIST_MARKER_GAP$1 = 8;
71172
71446
  const DEFAULT_TAB_INTERVAL_PX$1 = 48;
71173
71447
  const COMMENT_EXTERNAL_COLOR = "#B1124B";
@@ -71929,7 +72203,7 @@ const _DomPainter = class _DomPainter2 {
71929
72203
  }
71930
72204
  const block = lookup2.block;
71931
72205
  const measure = lookup2.measure;
71932
- const wordLayout = block.attrs?.wordLayout;
72206
+ const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : void 0;
71933
72207
  const fragmentEl = this.doc.createElement("div");
71934
72208
  fragmentEl.classList.add(CLASS_NAMES$1.fragment);
71935
72209
  const isTocEntry = block.attrs?.isTocEntry;
@@ -71970,11 +72244,11 @@ const _DomPainter = class _DomPainter2 {
71970
72244
  const paraIndentRight = paraIndent?.right ?? 0;
71971
72245
  const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
71972
72246
  const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
71973
- const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
71974
72247
  const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
71975
72248
  const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
71976
72249
  lines.forEach((line, index2) => {
71977
- const availableWidthOverride = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
72250
+ const fallbackAvailableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
72251
+ const availableWidthOverride = line.maxWidth ?? fallbackAvailableWidth;
71978
72252
  const isLastLineOfFragment = index2 === lines.length - 1;
71979
72253
  const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
71980
72254
  const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
@@ -71984,7 +72258,7 @@ const _DomPainter = class _DomPainter2 {
71984
72258
  context,
71985
72259
  availableWidthOverride,
71986
72260
  fragment.fromLine + index2,
71987
- isListParagraph || shouldSkipJustifyForLastLine
72261
+ shouldSkipJustifyForLastLine
71988
72262
  );
71989
72263
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
71990
72264
  const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
@@ -72008,8 +72282,17 @@ const _DomPainter = class _DomPainter2 {
72008
72282
  lineEl.style.textIndent = "0px";
72009
72283
  }
72010
72284
  if (isListFirstLine && wordLayout?.marker && fragment.markerWidth) {
72011
- const markerStartPos = paraIndentLeft - (paraIndent?.hanging ?? 0);
72012
- lineEl.style.paddingLeft = `${markerStartPos}px`;
72285
+ const isFirstLineIndentMode = wordLayout.firstLineIndentMode === true;
72286
+ let markerStartPos;
72287
+ if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
72288
+ markerStartPos = wordLayout.marker.markerX;
72289
+ } else if (isFirstLineIndentMode) {
72290
+ markerStartPos = paraIndentLeft + (paraIndent?.firstLine ?? 0);
72291
+ } else {
72292
+ markerStartPos = paraIndentLeft - (paraIndent?.hanging ?? 0);
72293
+ }
72294
+ const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
72295
+ lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
72013
72296
  const markerContainer = this.doc.createElement("span");
72014
72297
  markerContainer.style.display = "inline-block";
72015
72298
  const markerEl = this.doc.createElement("span");
@@ -72025,7 +72308,7 @@ const _DomPainter = class _DomPainter2 {
72025
72308
  if (markerJustification === "left") {
72026
72309
  markerContainer.style.position = "relative";
72027
72310
  } else {
72028
- const markerLeftX = markerStartPos - fragment.markerWidth;
72311
+ const markerLeftX = validMarkerStartPos - fragment.markerWidth;
72029
72312
  markerContainer.style.position = "absolute";
72030
72313
  markerContainer.style.left = `${markerLeftX}px`;
72031
72314
  markerContainer.style.top = "0";
@@ -72050,12 +72333,36 @@ const _DomPainter = class _DomPainter2 {
72050
72333
  const markerBoxWidth = fragment.markerWidth;
72051
72334
  const markerTextWidth = fragment.markerTextWidth != null && isFinite(fragment.markerTextWidth) && fragment.markerTextWidth >= 0 ? fragment.markerTextWidth : markerBoxWidth;
72052
72335
  if ((wordLayout.marker.justification ?? "left") === "left") {
72053
- const currentPos = markerStartPos + markerTextWidth;
72054
- const implicitTabStop = paraIndentLeft;
72055
- tabWidth = implicitTabStop - currentPos;
72056
- if (tabWidth < 1) {
72057
- tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
72058
- if (tabWidth === 0) tabWidth = DEFAULT_TAB_INTERVAL_PX$1;
72336
+ const currentPos = validMarkerStartPos + markerTextWidth;
72337
+ if (isFirstLineIndentMode) {
72338
+ const explicitTabs = wordLayout.tabsPx;
72339
+ let targetTabStop;
72340
+ if (Array.isArray(explicitTabs) && explicitTabs.length > 0) {
72341
+ for (const tab of explicitTabs) {
72342
+ if (typeof tab === "number" && tab > currentPos) {
72343
+ targetTabStop = tab;
72344
+ break;
72345
+ }
72346
+ }
72347
+ }
72348
+ const textStartTarget = wordLayout.marker.textStartX !== void 0 && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : wordLayout.textStartPx;
72349
+ if (targetTabStop !== void 0) {
72350
+ tabWidth = targetTabStop - currentPos;
72351
+ } else if (textStartTarget !== void 0 && Number.isFinite(textStartTarget) && textStartTarget > currentPos) {
72352
+ tabWidth = textStartTarget - currentPos;
72353
+ } else {
72354
+ tabWidth = LIST_MARKER_GAP$1;
72355
+ }
72356
+ if (tabWidth < LIST_MARKER_GAP$1) {
72357
+ tabWidth = LIST_MARKER_GAP$1;
72358
+ }
72359
+ } else {
72360
+ const implicitTabStop = paraIndentLeft;
72361
+ tabWidth = implicitTabStop - currentPos;
72362
+ if (tabWidth < 1) {
72363
+ tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
72364
+ if (tabWidth === 0) tabWidth = DEFAULT_TAB_INTERVAL_PX$1;
72365
+ }
72059
72366
  }
72060
72367
  } else {
72061
72368
  tabWidth = fragment.markerGutter != null && isFinite(fragment.markerGutter) ? fragment.markerGutter : typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx > 0 ? wordLayout.marker.gutterWidthPx : LIST_MARKER_GAP$1;
@@ -76027,8 +76334,13 @@ function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLin
76027
76334
  toLineByCell.push(cutLine);
76028
76335
  heightByCell.push(cumulativeHeight);
76029
76336
  }
76030
- const positiveHeights = heightByCell.filter((h2) => h2 > 0);
76031
- const minHeight = positiveHeights.length > 0 ? Math.min(...positiveHeights) : 0;
76337
+ const allCellsCompleteInFirstPass = toLineByCell.every((cutLine, idx) => {
76338
+ const totalLines = getCellTotalLines(row.cells[idx]);
76339
+ return cutLine >= totalLines;
76340
+ });
76341
+ const lineAdvancements = toLineByCell.map((cutLine, idx) => cutLine - (startLines[idx] || 0));
76342
+ const positiveAdvancements = lineAdvancements.filter((adv) => adv > 0);
76343
+ const minLineAdvancement = positiveAdvancements.length > 0 ? Math.min(...positiveAdvancements) : 0;
76032
76344
  let actualPartialHeight = 0;
76033
76345
  let maxPaddingTotal = 0;
76034
76346
  for (let cellIdx = 0; cellIdx < cellCount; cellIdx++) {
@@ -76038,18 +76350,17 @@ function computePartialRow(rowIndex, blockRow, measure, availableHeight, fromLin
76038
76350
  const cellPadding = cellPaddings[cellIdx];
76039
76351
  const paddingTotal = cellPadding.top + cellPadding.bottom;
76040
76352
  maxPaddingTotal = Math.max(maxPaddingTotal, paddingTotal);
76041
- let cumulativeHeight = 0;
76042
- let cutLine = startLine;
76043
- for (let i = startLine; i < lines.length; i++) {
76044
- const lineHeight2 = lines[i].lineHeight || 0;
76045
- if (cumulativeHeight + lineHeight2 > minHeight) {
76046
- break;
76353
+ if (allCellsCompleteInFirstPass) {
76354
+ actualPartialHeight = Math.max(actualPartialHeight, heightByCell[cellIdx] + paddingTotal);
76355
+ } else {
76356
+ const targetLine = Math.min(startLine + minLineAdvancement, lines.length);
76357
+ let cumulativeHeight = 0;
76358
+ for (let i = startLine; i < targetLine; i++) {
76359
+ cumulativeHeight += lines[i].lineHeight || 0;
76047
76360
  }
76048
- cumulativeHeight += lineHeight2;
76049
- cutLine = i + 1;
76361
+ toLineByCell[cellIdx] = targetLine;
76362
+ actualPartialHeight = Math.max(actualPartialHeight, cumulativeHeight + paddingTotal);
76050
76363
  }
76051
- toLineByCell[cellIdx] = cutLine;
76052
- actualPartialHeight = Math.max(actualPartialHeight, cumulativeHeight + paddingTotal);
76053
76364
  }
76054
76365
  const madeProgress = toLineByCell.some((cutLine, idx) => cutLine > (startLines[idx] || 0));
76055
76366
  const isFirstPart = startLines.every((l3) => l3 === 0);
@@ -76277,7 +76588,6 @@ function layoutTableBlock({
76277
76588
  } else if (!madeProgress && hadRemainingLinesBefore) {
76278
76589
  state2 = advanceColumn(state2);
76279
76590
  } else {
76280
- state2 = advanceColumn(state2);
76281
76591
  pendingPartialRow = continuationPartialRow;
76282
76592
  }
76283
76593
  isTableContinuation = true;
@@ -91037,6 +91347,52 @@ function createDropcapPlugin(editor) {
91037
91347
  }
91038
91348
  });
91039
91349
  }
91350
+ function parseAttrs(node) {
91351
+ const numberingProperties = {};
91352
+ let indent, spacing;
91353
+ const { styleid: styleId, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
91354
+ if (attr.name === "data-num-id") {
91355
+ numberingProperties.numId = parseInt(attr.value);
91356
+ } else if (attr.name === "data-level") {
91357
+ numberingProperties.ilvl = parseInt(attr.value);
91358
+ } else if (attr.name === "data-indent") {
91359
+ try {
91360
+ indent = JSON.parse(attr.value);
91361
+ Object.keys(indent).forEach((key2) => {
91362
+ indent[key2] = Number(indent[key2]);
91363
+ });
91364
+ } catch {
91365
+ }
91366
+ } else if (attr.name === "data-spacing") {
91367
+ try {
91368
+ spacing = JSON.parse(attr.value);
91369
+ Object.keys(spacing).forEach((key2) => {
91370
+ spacing[key2] = Number(spacing[key2]);
91371
+ });
91372
+ } catch {
91373
+ }
91374
+ } else {
91375
+ acc[attr.name] = attr.value;
91376
+ }
91377
+ return acc;
91378
+ }, {});
91379
+ let attrs = {
91380
+ paragraphProperties: {
91381
+ styleId: styleId || null
91382
+ },
91383
+ extraAttrs
91384
+ };
91385
+ if (indent && Object.keys(indent).length > 0) {
91386
+ attrs.paragraphProperties.indent = indent;
91387
+ }
91388
+ if (spacing && Object.keys(spacing).length > 0) {
91389
+ attrs.paragraphProperties.spacing = spacing;
91390
+ }
91391
+ if (Object.keys(numberingProperties).length > 0) {
91392
+ attrs.paragraphProperties.numberingProperties = numberingProperties;
91393
+ }
91394
+ return attrs;
91395
+ }
91040
91396
  const bulletInputRegex = /^\s*([-+*])\s$/;
91041
91397
  const orderedInputRegex = /^(\d+)\.\s$/;
91042
91398
  const Paragraph = OxmlNode.create({
@@ -91106,50 +91462,7 @@ const Paragraph = OxmlNode.create({
91106
91462
  return [
91107
91463
  {
91108
91464
  tag: "p",
91109
- getAttrs: (node) => {
91110
- const numberingProperties = {};
91111
- let indent, spacing;
91112
- const { styleid: styleId, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
91113
- if (attr.name === "data-num-id") {
91114
- numberingProperties.numId = parseInt(attr.value);
91115
- } else if (attr.name === "data-level") {
91116
- numberingProperties.ilvl = parseInt(attr.value);
91117
- } else if (attr.name === "data-indent") {
91118
- try {
91119
- indent = JSON.parse(attr.value);
91120
- Object.keys(indent).forEach((key2) => {
91121
- indent[key2] = Number(indent[key2]);
91122
- });
91123
- } catch {
91124
- }
91125
- } else if (attr.name === "data-spacing") {
91126
- try {
91127
- spacing = JSON.parse(attr.value);
91128
- Object.keys(spacing).forEach((key2) => {
91129
- spacing[key2] = Number(spacing[key2]);
91130
- });
91131
- } catch {
91132
- }
91133
- } else {
91134
- acc[attr.name] = attr.value;
91135
- }
91136
- return acc;
91137
- }, {});
91138
- if (Object.keys(numberingProperties).length > 0) {
91139
- return {
91140
- paragraphProperties: {
91141
- numberingProperties,
91142
- indent,
91143
- spacing,
91144
- styleId: styleId || null
91145
- },
91146
- extraAttrs
91147
- };
91148
- }
91149
- return {
91150
- extraAttrs
91151
- };
91152
- }
91465
+ getAttrs: parseAttrs
91153
91466
  },
91154
91467
  {
91155
91468
  tag: "div",
@@ -91167,7 +91480,16 @@ const Paragraph = OxmlNode.create({
91167
91480
  },
91168
91481
  ...this.options.headingLevels.map((level) => ({
91169
91482
  tag: `h${level}`,
91170
- attrs: { level, paragraphProperties: { styleId: `Heading${level}` } }
91483
+ getAttrs: (node) => {
91484
+ let attrs = parseAttrs(node);
91485
+ return {
91486
+ ...attrs,
91487
+ paragraphProperties: {
91488
+ ...attrs.paragraphProperties,
91489
+ styleId: `Heading${level}`
91490
+ }
91491
+ };
91492
+ }
91171
91493
  }))
91172
91494
  ];
91173
91495
  },
@@ -97658,6 +97980,14 @@ const Image = Node$1.create({
97658
97980
  if (!style2) return {};
97659
97981
  return { style: style2 };
97660
97982
  }
97983
+ },
97984
+ drawingChildOrder: {
97985
+ default: null,
97986
+ rendered: false
97987
+ },
97988
+ originalDrawingChildren: {
97989
+ default: null,
97990
+ rendered: false
97661
97991
  }
97662
97992
  };
97663
97993
  },
@@ -102272,11 +102602,11 @@ const getChangesByIdToResolve = (state2, id) => {
102272
102602
  break;
102273
102603
  }
102274
102604
  const [left2, right2] = direction < 0 ? [neighbor, currentChange] : [currentChange, neighbor];
102275
- if (!areDirectlyConnected(left2, right2)) {
102276
- break;
102277
- }
102278
102605
  const sharesId = neighbor.mark.attrs.id === matchingId;
102279
102606
  const complementary = isComplementaryPair(currentChange.mark.type.name, neighbor.mark.type.name);
102607
+ if (!sharesId && !areDirectlyConnected(left2, right2)) {
102608
+ break;
102609
+ }
102280
102610
  if (!sharesId && !complementary) {
102281
102611
  break;
102282
102612
  }