superdoc 0.31.0-next.5 → 0.31.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/chunks/{PdfViewer-DXwcotXc.cjs → PdfViewer-C_gVEaJa.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BjFaPQBd.es.js → PdfViewer-HhmcCtfd.es.js} +1 -1
  3. package/dist/chunks/{index-B7dC-H-Q-DfBEU7rR.cjs → index-BJ6cOegF-BuvRSNoV.cjs} +1 -1
  4. package/dist/chunks/{index-B7dC-H-Q-BeQx_MXI.es.js → index-BJ6cOegF-C-oX4LAe.es.js} +1 -1
  5. package/dist/chunks/{index-B6TttOzK.es.js → index-Cz10rZ5n.es.js} +3 -3
  6. package/dist/chunks/{index-BF_Yvius.cjs → index-wLtubQ87.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-CVDIAxlg.cjs → super-editor.es-Bz-s1Pw4.cjs} +351 -155
  8. package/dist/chunks/{super-editor.es-M2e4wbRW.es.js → super-editor.es-C20nShDu.es.js} +351 -155
  9. package/dist/style.css +10 -9
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-BIsS-JzD.js → converter-DVDL6NWz.js} +100 -53
  12. package/dist/super-editor/chunks/{docx-zipper-DVDiaIyD.js → docx-zipper-4ipmBNSH.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-ZbcM1RTL.js → editor-B8v33PJq.js} +253 -104
  14. package/dist/super-editor/chunks/{index-B7dC-H-Q.js → index-BJ6cOegF.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-8qqw8IXG.js → toolbar-CfUofx7k.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/style.css +10 -9
  21. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +7 -0
  22. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts.map +1 -1
  23. package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts +2 -1
  24. package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts.map +1 -1
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/legacy-handle-paragraph-node.d.ts.map +1 -1
  26. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts +14 -10
  27. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/tblGrid-translator.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-translator.d.ts.map +1 -1
  30. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts +1 -0
  31. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts.map +1 -1
  32. package/dist/super-editor/super-editor/src/extensions/linked-styles/plugin.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
  34. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +8 -2
  35. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
  36. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentByGroup.d.ts +19 -0
  37. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentByGroup.d.ts.map +1 -0
  38. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +2 -0
  39. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/tagUtils.d.ts +53 -0
  40. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/tagUtils.d.ts.map +1 -0
  41. package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts +7 -1
  42. package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts.map +1 -1
  43. package/dist/super-editor/super-editor/src/extensions/table/table.d.ts +18 -0
  44. package/dist/super-editor/super-editor/src/extensions/table/table.d.ts.map +1 -1
  45. package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts.map +1 -1
  46. package/dist/super-editor/super-editor.es.js +7 -7
  47. package/dist/super-editor/toolbar.es.js +2 -2
  48. package/dist/super-editor.cjs +1 -1
  49. package/dist/super-editor.es.js +1 -1
  50. package/dist/superdoc.cjs +2 -2
  51. package/dist/superdoc.es.js +2 -2
  52. package/dist/superdoc.umd.js +352 -156
  53. package/dist/superdoc.umd.js.map +1 -1
  54. package/package.json +1 -1
@@ -15427,6 +15427,38 @@
15427
15427
  if (element2.className?.split(" ")?.indexOf(classname) >= 0) return true;
15428
15428
  return element2.parentNode && hasSomeParentWithClass(element2.parentNode, classname);
15429
15429
  };
15430
+ function convertSizeToCSS(value, type2) {
15431
+ if (typeof value === "string" && value.endsWith("%")) {
15432
+ type2 = "pct";
15433
+ }
15434
+ if (value === null || value === void 0) {
15435
+ value = 0;
15436
+ }
15437
+ switch (type2) {
15438
+ case "dxa":
15439
+ case null:
15440
+ case void 0:
15441
+ return `${twipsToPixels(value)}px`;
15442
+ case "nil":
15443
+ return "0";
15444
+ case "auto":
15445
+ return null;
15446
+ case "pct":
15447
+ let percent2;
15448
+ if (typeof value === "number") {
15449
+ percent2 = value * 0.02;
15450
+ } else {
15451
+ if (value.endsWith("%")) {
15452
+ percent2 = parseFloat(value.slice(0, -1));
15453
+ } else {
15454
+ percent2 = parseFloat(value) * 0.02;
15455
+ }
15456
+ }
15457
+ return `${percent2}%`;
15458
+ default:
15459
+ return null;
15460
+ }
15461
+ }
15430
15462
  const DEFAULT_DOCX_DEFS = {
15431
15463
  "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15432
15464
  "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
@@ -19239,7 +19271,7 @@
19239
19271
  const finalProps = combineProperties(styleChain, ["fontFamily", "color"]);
19240
19272
  return finalProps;
19241
19273
  };
19242
- function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false) {
19274
+ function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
19243
19275
  const defaultProps2 = getDefaultProperties(params2, translator$12);
19244
19276
  const { properties: normalProps, isDefault: isNormalDefault } = getStyleProperties(params2, "Normal", translator$12);
19245
19277
  let styleId = inlineProps?.styleId;
@@ -19264,13 +19296,14 @@
19264
19296
  }
19265
19297
  }
19266
19298
  }
19299
+ const tableProps = tableStyleId ? resolveStyleChain(params2, tableStyleId, translator$12) : {};
19267
19300
  let defaultsChain;
19268
19301
  if (isNormalDefault) {
19269
19302
  defaultsChain = [defaultProps2, normalProps];
19270
19303
  } else {
19271
19304
  defaultsChain = [normalProps, defaultProps2];
19272
19305
  }
19273
- const propsChain = [...defaultsChain, numberingProps, styleProps, inlineProps];
19306
+ const propsChain = [...defaultsChain, tableProps, numberingProps, styleProps, inlineProps];
19274
19307
  let indentChain;
19275
19308
  if (isList2) {
19276
19309
  if (numberingDefinedInline) {
@@ -20021,6 +20054,21 @@
20021
20054
  if (value === "0" || value === "false" || value === "off") return "0";
20022
20055
  return "1";
20023
20056
  }
20057
+ function getTableStyleId(path2) {
20058
+ const tbl = path2.find((ancestor) => ancestor.name === "w:tbl");
20059
+ if (!tbl) {
20060
+ return;
20061
+ }
20062
+ const tblPr = tbl.elements?.find((child) => child.name === "w:tblPr");
20063
+ if (!tblPr) {
20064
+ return;
20065
+ }
20066
+ const tblStyle = tblPr.elements?.find((child) => child.name === "w:tblStyle");
20067
+ if (!tblStyle) {
20068
+ return;
20069
+ }
20070
+ return tblStyle.attributes?.["w:val"];
20071
+ }
20024
20072
  const handleParagraphNode$1 = (params2) => {
20025
20073
  const { nodes, nodeListHandler, filename } = params2;
20026
20074
  const node2 = carbonCopy(nodes[0]);
@@ -20031,7 +20079,14 @@
20031
20079
  inlineParagraphProperties = translator$12.encode({ ...params2, nodes: [pPr] }) || {};
20032
20080
  }
20033
20081
  const insideTable = (params2.path || []).some((ancestor) => ancestor.name === "w:tc");
20034
- const resolvedParagraphProperties = resolveParagraphProperties(params2, inlineParagraphProperties, insideTable);
20082
+ const tableStyleId = getTableStyleId(params2.path || []);
20083
+ const resolvedParagraphProperties = resolveParagraphProperties(
20084
+ params2,
20085
+ inlineParagraphProperties,
20086
+ insideTable,
20087
+ false,
20088
+ tableStyleId
20089
+ );
20035
20090
  const handleStandardNode2 = nodeListHandler.handlerEntities.find(
20036
20091
  (e) => e.handlerName === "standardNodeHandler"
20037
20092
  )?.handler;
@@ -21386,6 +21441,7 @@
21386
21441
  const columnWidth = gridColumnWidths?.[startColumn] || null;
21387
21442
  const result = translator$G.encode({
21388
21443
  ...params2,
21444
+ path: [...params2.path || [], node2],
21389
21445
  extraParams: {
21390
21446
  ...params2.extraParams,
21391
21447
  node: node2,
@@ -31556,14 +31612,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31556
31612
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
31557
31613
  const { firstRow = {} } = params2.extraParams || {};
31558
31614
  const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
31559
- const columnCountFromCells = cellNodes.reduce((count, cell2) => {
31615
+ const colWidthsFromCellNodes = cellNodes.flatMap((cell2) => {
31560
31616
  const spanCount = Math.max(1, cell2?.attrs?.colspan ?? 1);
31561
- return count + spanCount;
31562
- }, 0);
31617
+ const colwidth = cell2.attrs?.colwidth;
31618
+ return Array.from({ length: spanCount }).map((_2, span) => Array.isArray(colwidth) ? colwidth[span] : void 0);
31619
+ });
31620
+ const columnCountFromCells = colWidthsFromCellNodes.length;
31563
31621
  const totalColumns = Math.max(columnCountFromCells, grid.length);
31564
31622
  const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params2, totalColumns, cellMinWidth);
31565
31623
  const elements = [];
31566
- let columnIndex = 0;
31567
31624
  const pushColumn = (widthTwips, { enforceMinimum = false } = {}) => {
31568
31625
  let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
31569
31626
  let shouldEnforceMinimum = enforceMinimum;
@@ -31582,39 +31639,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31582
31639
  });
31583
31640
  if (decoded) elements.push(decoded);
31584
31641
  };
31585
- cellNodes.forEach((cell2) => {
31586
- const { colspan = 1, colwidth } = cell2?.attrs || {};
31587
- const spanCount = Math.max(1, colspan);
31588
- for (let span = 0; span < spanCount; span++) {
31589
- const rawWidth = Array.isArray(colwidth) ? colwidth[span] : void 0;
31590
- const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
31591
- const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
31592
- const colGridAttrs = grid?.[columnIndex] || {};
31593
- const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
31594
- const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
31595
- let cellWidthTwips;
31596
- let enforceMinimum = false;
31597
- if (hasCellWidth) {
31598
- const tolerance = 0.5;
31599
- if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
31600
- cellWidthTwips = gridWidthTwips;
31601
- } else {
31602
- cellWidthTwips = pixelsToTwips(cellWidthPixels);
31603
- }
31604
- } else if (gridWidthTwips != null) {
31642
+ for (let columnIndex = 0; columnIndex < totalColumns; ++columnIndex) {
31643
+ const rawWidth = colWidthsFromCellNodes[columnIndex];
31644
+ const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
31645
+ const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
31646
+ const colGridAttrs = grid?.[columnIndex] || {};
31647
+ const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
31648
+ const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
31649
+ let cellWidthTwips;
31650
+ let enforceMinimum = false;
31651
+ if (gridWidthTwips != null) {
31652
+ cellWidthTwips = gridWidthTwips;
31653
+ } else if (hasCellWidth) {
31654
+ const tolerance = 0.5;
31655
+ if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
31605
31656
  cellWidthTwips = gridWidthTwips;
31606
31657
  } else {
31607
- cellWidthTwips = fallbackColumnWidthTwips;
31608
- enforceMinimum = true;
31658
+ cellWidthTwips = pixelsToTwips(cellWidthPixels);
31609
31659
  }
31610
- pushColumn(cellWidthTwips, { enforceMinimum });
31611
- columnIndex++;
31660
+ } else {
31661
+ cellWidthTwips = fallbackColumnWidthTwips;
31662
+ enforceMinimum = true;
31612
31663
  }
31613
- });
31614
- while (columnIndex < grid.length) {
31615
- const gridWidthTwips = normalizeTwipWidth(grid[columnIndex]?.col);
31616
- pushColumn(gridWidthTwips);
31617
- columnIndex++;
31664
+ pushColumn(cellWidthTwips, { enforceMinimum });
31618
31665
  }
31619
31666
  const newNode = {
31620
31667
  name: XML_NODE_NAME$b,
@@ -31701,6 +31748,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31701
31748
  if (tblPr) {
31702
31749
  const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
31703
31750
  encodedAttrs["tableProperties"] = encodedProperties || {};
31751
+ } else {
31752
+ encodedAttrs["tableProperties"] || (encodedAttrs["tableProperties"] = {});
31704
31753
  }
31705
31754
  const tblGrid = node2.elements.find((el) => el.name === "w:tblGrid");
31706
31755
  if (tblGrid) {
@@ -31721,14 +31770,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31721
31770
  key2 = prop;
31722
31771
  transform = (v2) => v2;
31723
31772
  }
31724
- if (encodedAttrs.tableProperties && encodedAttrs.tableProperties[key2]) {
31773
+ if (encodedAttrs.tableProperties[key2]) {
31725
31774
  encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
31726
31775
  }
31727
31776
  });
31728
31777
  if (encodedAttrs.tableCellSpacing) {
31729
31778
  encodedAttrs["borderCollapse"] = "separate";
31730
31779
  }
31731
- if (encodedAttrs.tableProperties?.tableWidth) {
31780
+ if (encodedAttrs.tableProperties.tableWidth) {
31732
31781
  const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
31733
31782
  const widthPx = twipsToPixels(tableWidthMeasurement.value);
31734
31783
  if (widthPx != null) {
@@ -31743,25 +31792,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31743
31792
  };
31744
31793
  }
31745
31794
  }
31746
- const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
31747
- const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
31748
- if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
31749
- encodedAttrs.tableProperties = {
31750
- ...encodedAttrs.tableProperties || {},
31751
- cellMargins: referencedStyles.cellMargins
31752
- };
31753
- }
31795
+ const borderProps = _processTableBorders(encodedAttrs.tableProperties.borders || {});
31796
+ const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2) || {};
31797
+ const rowBorders = { ...referencedStyles.rowBorders, ...borderProps.rowBorders };
31798
+ encodedAttrs.borders = { ...referencedStyles.borders, ...borderProps.borders };
31799
+ encodedAttrs.tableProperties.cellMargins = referencedStyles.cellMargins = {
31800
+ ...referencedStyles.cellMargins,
31801
+ ...encodedAttrs.tableProperties.cellMargins
31802
+ };
31754
31803
  const rows = node2.elements.filter((el) => el.name === "w:tr");
31755
- const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
31756
- const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
31757
- encodedAttrs["borders"] = borderData;
31758
31804
  let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
31759
31805
  if (!columnWidths.length) {
31760
31806
  const fallback = buildFallbackGridForTable({
31761
31807
  params: params2,
31762
31808
  rows,
31763
31809
  tableWidth: encodedAttrs.tableWidth,
31764
- tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
31810
+ tableWidthMeasurement: encodedAttrs.tableProperties.tableWidth
31765
31811
  });
31766
31812
  if (fallback) {
31767
31813
  encodedAttrs.grid = fallback.grid;
@@ -31774,11 +31820,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
31774
31820
  rows.forEach((row2, rowIndex) => {
31775
31821
  const result = translator$v.encode({
31776
31822
  ...params2,
31823
+ path: [...params2.path || [], node2],
31777
31824
  nodes: [row2],
31778
31825
  extraParams: {
31779
31826
  row: row2,
31780
31827
  table: node2,
31781
- rowBorders: borderRowData,
31828
+ rowBorders,
31782
31829
  columnWidths,
31783
31830
  activeRowSpans: activeRowSpans.slice(),
31784
31831
  rowIndex,
@@ -35303,7 +35350,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35303
35350
  static getStoredSuperdocVersion(docx) {
35304
35351
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35305
35352
  }
35306
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.5") {
35353
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.7") {
35307
35354
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35308
35355
  }
35309
35356
  /**
@@ -60304,7 +60351,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60304
60351
  { default: remarkStringify2 },
60305
60352
  { default: remarkGfm2 }
60306
60353
  ] = await Promise.all([
60307
- Promise.resolve().then(() => indexB7dCHQ),
60354
+ Promise.resolve().then(() => indexBJ6cOegF),
60308
60355
  Promise.resolve().then(() => indexDRCvimau),
60309
60356
  Promise.resolve().then(() => indexC_x_N6Uh),
60310
60357
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -60505,7 +60552,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
60505
60552
  * Process collaboration migrations
60506
60553
  */
60507
60554
  processCollaborationMigrations() {
60508
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.5");
60555
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.7");
60509
60556
  if (!this.options.ydoc) return;
60510
60557
  const metaMap = this.options.ydoc.getMap("meta");
60511
60558
  let docVersion = metaMap.get("version");
@@ -62914,6 +62961,46 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62914
62961
  });
62915
62962
  return result;
62916
62963
  }
62964
+ function createTagObject(tagData) {
62965
+ if (!tagData || typeof tagData !== "object") {
62966
+ return null;
62967
+ }
62968
+ return JSON.stringify(tagData);
62969
+ }
62970
+ function parseTagObject(tag) {
62971
+ if (typeof tag !== "string" || !tag.startsWith("{")) {
62972
+ return null;
62973
+ }
62974
+ try {
62975
+ const parsed = JSON.parse(tag);
62976
+ return parsed && typeof parsed === "object" ? parsed : null;
62977
+ } catch {
62978
+ return null;
62979
+ }
62980
+ }
62981
+ function hasGroup(tag) {
62982
+ const parsed = parseTagObject(tag);
62983
+ return parsed !== null && typeof parsed.group === "string";
62984
+ }
62985
+ function getGroup(tag) {
62986
+ const parsed = parseTagObject(tag);
62987
+ return parsed && typeof parsed.group === "string" ? parsed.group : null;
62988
+ }
62989
+ function getStructuredContentByGroup(groupOrGroups, state2) {
62990
+ const searchGroups = Array.isArray(groupOrGroups) ? groupOrGroups : [groupOrGroups];
62991
+ const result = findChildren$5(state2.doc, (node2) => {
62992
+ const isStructuredContent = ["structuredContent", "structuredContentBlock"].includes(node2.type.name);
62993
+ if (!isStructuredContent) {
62994
+ return false;
62995
+ }
62996
+ const nodeGroup = getGroup(node2.attrs.tag);
62997
+ if (!nodeGroup) {
62998
+ return false;
62999
+ }
63000
+ return searchGroups.includes(nodeGroup);
63001
+ });
63002
+ return result;
63003
+ }
62917
63004
  function getStructuredContentTags(state2) {
62918
63005
  const result = findChildren$5(state2.doc, (node2) => {
62919
63006
  return node2.type.name === "structuredContent" || node2.type.name === "structuredContentBlock";
@@ -62946,11 +63033,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62946
63033
  }
62947
63034
  const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
62948
63035
  __proto__: null,
63036
+ createTagObject,
63037
+ getGroup,
62949
63038
  getStructuredContentBlockTags,
63039
+ getStructuredContentByGroup,
62950
63040
  getStructuredContentInlineTags,
62951
63041
  getStructuredContentTablesById,
62952
63042
  getStructuredContentTags,
62953
- getStructuredContentTagsById
63043
+ getStructuredContentTagsById,
63044
+ hasGroup,
63045
+ parseTagObject
62954
63046
  }, Symbol.toStringTag, { value: "Module" }));
62955
63047
  const STRUCTURED_CONTENT_NAMES = ["structuredContent", "structuredContentBlock"];
62956
63048
  const StructuredContentCommands = Extension.create({
@@ -62962,6 +63054,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62962
63054
  * @category Command
62963
63055
  * @param {StructuredContentInlineInsert} options
62964
63056
  * @example
63057
+ * // With group for linking multiple fields
63058
+ * editor.commands.insertStructuredContentInline({
63059
+ * attrs: {
63060
+ * group: 'customer-info',
63061
+ * alias: 'Customer Name',
63062
+ * },
63063
+ * text: 'John Doe',
63064
+ * });
63065
+ *
63066
+ * // No group
62965
63067
  * editor.commands.insertStructuredContentInline({
62966
63068
  * attrs: {
62967
63069
  * id: '123',
@@ -62990,12 +63092,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62990
63092
  if (!content2) {
62991
63093
  content2 = schema.text(" ");
62992
63094
  }
63095
+ let tag = options.attrs?.tag || "inline_text_sdt";
63096
+ if (options.attrs?.group) {
63097
+ tag = createTagObject({ group: options.attrs.group });
63098
+ }
62993
63099
  const attrs = {
62994
- ...options.attrs,
62995
63100
  id: options.attrs?.id || generateRandomSigned32BitIntStrId(),
62996
- tag: "inline_text_sdt",
62997
- alias: options.attrs?.alias || "Structured content"
63101
+ tag,
63102
+ alias: options.attrs?.alias || "Structured content",
63103
+ ...options.attrs
62998
63104
  };
63105
+ delete attrs.group;
62999
63106
  const node2 = schema.nodes.structuredContent.create(attrs, content2, null);
63000
63107
  const parent = findParentNode((node22) => node22.type.name === "structuredContent")(state2.selection);
63001
63108
  if (parent) {
@@ -63011,14 +63118,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63011
63118
  * @category Command
63012
63119
  * @param {StructuredContentBlockInsert} options
63013
63120
  * @example
63121
+ * // With group for linking multiple fields
63122
+ * editor.commands.insertStructuredContentBlock({
63123
+ * attrs: {
63124
+ * group: 'terms-section',
63125
+ * alias: 'Terms & Conditions',
63126
+ * },
63127
+ * html: '<p>Legal content...</p>',
63128
+ * });
63129
+ *
63130
+ * // No group
63014
63131
  * editor.commands.insertStructuredContentBlock({
63015
63132
  * attrs: {
63016
63133
  * id: '456',
63017
63134
  * alias: 'Terms & Conditions',
63018
63135
  * },
63019
63136
  * json: { type: 'paragraph', content: [{ type: 'text', text: 'Legal content...' }] }
63020
- * // or
63021
- * html: '<p>Legal content...</p>',
63022
63137
  * });
63023
63138
  */
63024
63139
  insertStructuredContentBlock: (options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -63041,12 +63156,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63041
63156
  if (!content2) {
63042
63157
  content2 = schema.nodeFromJSON({ type: "paragraph", content: [] });
63043
63158
  }
63159
+ let tag = options.attrs?.tag || "block_table_sdt";
63160
+ if (options.attrs?.group) {
63161
+ tag = createTagObject({ group: options.attrs.group });
63162
+ }
63044
63163
  const attrs = {
63045
- ...options.attrs,
63046
63164
  id: options.attrs?.id || generateRandomSigned32BitIntStrId(),
63047
- tag: "block_table_sdt",
63048
- alias: options.attrs?.alias || "Structured content"
63165
+ tag,
63166
+ alias: options.attrs?.alias || "Structured content",
63167
+ ...options.attrs
63049
63168
  };
63169
+ delete attrs.group;
63050
63170
  const node2 = schema.nodes.structuredContentBlock.create(attrs, content2, null);
63051
63171
  const parent = findParentNode((node22) => node22.type.name === "structuredContentBlock")(state2.selection);
63052
63172
  if (parent) {
@@ -63176,6 +63296,85 @@ Please report this to https://github.com/markedjs/marked.`, e) {
63176
63296
  }
63177
63297
  return true;
63178
63298
  },
63299
+ /**
63300
+ * Updates all structured content fields that share the same group identifier.
63301
+ * Groups allow linking multiple fields together for batch operations.
63302
+ * @category Command
63303
+ * @param {string} group - Group identifier shared by multiple fields
63304
+ * @param {StructuredContentUpdate} options
63305
+ * @example
63306
+ * // Update all fields in the customer-info group
63307
+ * editor.commands.updateStructuredContentByGroup('customer-info', { text: 'Jane Doe' });
63308
+ *
63309
+ * // Update block content in a group
63310
+ * editor.commands.updateStructuredContentByGroup('terms-section', {
63311
+ * html: '<p>Updated terms...</p>'
63312
+ * });
63313
+ */
63314
+ updateStructuredContentByGroup: (group, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
63315
+ const structuredContentTags = getStructuredContentByGroup(group, state2);
63316
+ if (!structuredContentTags.length) {
63317
+ return true;
63318
+ }
63319
+ const { schema } = editor;
63320
+ if (dispatch) {
63321
+ structuredContentTags.forEach((structuredContent) => {
63322
+ const { pos, node: node2 } = structuredContent;
63323
+ const posFrom = tr.mapping.map(pos);
63324
+ const posTo = tr.mapping.map(pos + node2.nodeSize);
63325
+ let content2 = null;
63326
+ if (options.text) {
63327
+ content2 = schema.text(options.text);
63328
+ }
63329
+ if (options.html) {
63330
+ const html2 = htmlHandler(options.html, editor);
63331
+ const doc2 = DOMParser$1.fromSchema(schema).parse(html2);
63332
+ content2 = doc2.content;
63333
+ }
63334
+ if (options.json) {
63335
+ content2 = schema.nodeFromJSON(options.json);
63336
+ }
63337
+ if (!content2) {
63338
+ content2 = node2.content;
63339
+ }
63340
+ const updatedNode = node2.type.create({ ...node2.attrs, ...options.attrs }, content2, node2.marks);
63341
+ const currentNode = tr.doc.nodeAt(posFrom);
63342
+ if (currentNode && node2.eq(currentNode)) {
63343
+ tr.replaceWith(posFrom, posTo, updatedNode);
63344
+ }
63345
+ });
63346
+ }
63347
+ return true;
63348
+ },
63349
+ /**
63350
+ * Removes all structured content fields that share the same group identifier.
63351
+ * @category Command
63352
+ * @param {string | string[]} groupOrGroups - Single group or array of groups
63353
+ * @example
63354
+ * // Delete all fields in a group
63355
+ * editor.commands.deleteStructuredContentByGroup('customer-info');
63356
+ *
63357
+ * // Delete multiple groups
63358
+ * editor.commands.deleteStructuredContentByGroup(['header', 'footer']);
63359
+ */
63360
+ deleteStructuredContentByGroup: (groupOrGroups) => ({ dispatch, state: state2, tr }) => {
63361
+ const structuredContentTags = getStructuredContentByGroup(groupOrGroups, state2);
63362
+ if (!structuredContentTags.length) {
63363
+ return true;
63364
+ }
63365
+ if (dispatch) {
63366
+ structuredContentTags.forEach((structuredContent) => {
63367
+ const { pos, node: node2 } = structuredContent;
63368
+ const posFrom = tr.mapping.map(pos);
63369
+ const posTo = tr.mapping.map(pos + node2.nodeSize);
63370
+ const currentNode = tr.doc.nodeAt(posFrom);
63371
+ if (currentNode && node2.eq(currentNode)) {
63372
+ tr.delete(posFrom, posTo);
63373
+ }
63374
+ });
63375
+ }
63376
+ return true;
63377
+ },
63179
63378
  /**
63180
63379
  * Append multiple rows to the end of a table inside a structured content block.
63181
63380
  * Each inner array represents the cell values for one new row.
@@ -64324,7 +64523,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64324
64523
  let selection = tr.selection;
64325
64524
  const state2 = editor.state;
64326
64525
  const focusState = CustomSelectionPluginKey.getState(state2);
64327
- if (selection.empty && focusState?.preservedSelection) {
64526
+ if (selection.empty && focusState?.preservedSelection && !focusState?.preservedSelection.empty) {
64328
64527
  selection = focusState.preservedSelection;
64329
64528
  tr.setSelection(selection);
64330
64529
  } else if (selection.empty && editor.options.lastSelection) {
@@ -64391,6 +64590,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64391
64590
  });
64392
64591
  return true;
64393
64592
  };
64593
+ const stepInsertsTextIntoStyledParagraph = (tr, oldEditorState, step, stepIndex) => {
64594
+ if (!step.slice || step.slice.size === 0 || typeof step.from !== "number") {
64595
+ return false;
64596
+ }
64597
+ let insertsText = false;
64598
+ step.slice.content.descendants((node2) => {
64599
+ if (node2.type?.name === "text" && node2.text?.length) {
64600
+ insertsText = true;
64601
+ return false;
64602
+ }
64603
+ return true;
64604
+ });
64605
+ if (!insertsText) return false;
64606
+ const docBeforeStep = tr.docs?.[stepIndex] || oldEditorState.doc;
64607
+ if (!docBeforeStep) return false;
64608
+ const resolvedPos = Math.min(step.from, docBeforeStep.content.size);
64609
+ const $pos = docBeforeStep.resolve(resolvedPos);
64610
+ for (let depth = $pos.depth; depth >= 0; depth--) {
64611
+ const node2 = $pos.node(depth);
64612
+ if (node2?.type?.name === "paragraph") {
64613
+ return Boolean(node2.attrs?.styleId);
64614
+ }
64615
+ }
64616
+ return false;
64617
+ };
64394
64618
  const LinkedStylesPluginKey = new PluginKey("linkedStyles");
64395
64619
  const createLinkedStylesPlugin = (editor) => {
64396
64620
  return new Plugin({
@@ -64424,7 +64648,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64424
64648
  if (tr.docChanged) {
64425
64649
  let mightAffectStyles = false;
64426
64650
  const styleRelatedMarks = /* @__PURE__ */ new Set(["textStyle", "bold", "italic", "underline", "strike"]);
64427
- tr.steps.forEach((step) => {
64651
+ tr.steps.forEach((step, index2) => {
64428
64652
  if (step.slice) {
64429
64653
  step.slice.content.descendants((node2) => {
64430
64654
  if (node2.attrs?.styleId) {
@@ -64445,6 +64669,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64445
64669
  mightAffectStyles = true;
64446
64670
  }
64447
64671
  }
64672
+ if (!mightAffectStyles && stepInsertsTextIntoStyledParagraph(tr, oldEditorState, step, index2)) {
64673
+ mightAffectStyles = true;
64674
+ }
64448
64675
  });
64449
64676
  if (mightAffectStyles) {
64450
64677
  const styles = LinkedStylesPluginKey.getState(editor.state).styles;
@@ -65795,6 +66022,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65795
66022
  }
65796
66023
  },
65797
66024
  styleId: {
66025
+ default: null,
66026
+ keepOnSplit: false,
65798
66027
  renderDOM: (attrs) => {
65799
66028
  if (!attrs.styleId) return {};
65800
66029
  return { styleid: attrs.styleId };
@@ -66540,15 +66769,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66540
66769
  };
66541
66770
  }
66542
66771
  });
66543
- const getColStyleDeclaration = (minWidth, width) => {
66544
- if (width != null) {
66545
- const numericWidth = Number(width);
66546
- if (Number.isFinite(numericWidth) && numericWidth >= 0) {
66547
- return ["width", `${numericWidth}px`];
66548
- }
66549
- }
66550
- return ["min-width", `${minWidth}px`];
66551
- };
66552
66772
  const createTableView = ({ editor }) => {
66553
66773
  return class TableView {
66554
66774
  constructor(node2, cellMinWidth2) {
@@ -66567,7 +66787,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66567
66787
  this.table = this.dom.appendChild(document.createElement("table"));
66568
66788
  this.colgroup = this.table.appendChild(document.createElement("colgroup"));
66569
66789
  updateTable(this.editor, this.node, this.table);
66570
- updateColumns(node2, this.colgroup, this.table, cellMinWidth2, void 0, void 0, this.editor);
66790
+ updateColumns(node2, this.colgroup, this.table);
66571
66791
  this.contentDOM = this.table.appendChild(document.createElement("tbody"));
66572
66792
  setTimeout(() => {
66573
66793
  updateTableWrapper(this.dom, this.table);
@@ -66579,7 +66799,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66579
66799
  }
66580
66800
  this.node = node2;
66581
66801
  updateTable(this.editor, node2, this.table);
66582
- updateColumns(node2, this.colgroup, this.table, this.cellMinWidth, void 0, void 0, this.editor);
66802
+ updateColumns(node2, this.colgroup, this.table, this.cellMinWidth);
66583
66803
  updateTableWrapper(this.dom, this.table);
66584
66804
  return true;
66585
66805
  }
@@ -66592,43 +66812,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66592
66812
  }
66593
66813
  };
66594
66814
  };
66595
- function updateColumns(node2, colgroup, table2, cellMinWidth2, overrideCol, overrideValue, editor) {
66815
+ function updateColumns(node2, colgroup, table2, cellMinWidth2) {
66596
66816
  const gridColumns = Array.isArray(node2.attrs?.grid) && node2.attrs.grid.length ? node2.attrs.grid.map((col) => twipsToPixels(col.col)) : null;
66597
66817
  const totalColumns = gridColumns?.length ?? null;
66598
- const pageBody = table2.closest(".page__body");
66599
- const wrapper = table2.parentElement;
66600
- let availableWidth = pageBody?.getBoundingClientRect?.().width;
66601
- if (!availableWidth && wrapper) {
66602
- availableWidth = wrapper.getBoundingClientRect().width;
66603
- }
66604
- if (typeof availableWidth === "number" && !Number.isNaN(availableWidth)) {
66605
- availableWidth = Math.max(availableWidth - 2, 0);
66606
- } else {
66607
- availableWidth = null;
66608
- }
66609
- const pageStyles = editor?.converter?.pageStyles;
66610
- if (pageStyles?.pageSize?.width) {
66611
- const toNumber2 = (v2) => typeof v2 === "number" ? v2 : parseFloat(v2) || 0;
66612
- const pageWidth = toNumber2(pageStyles.pageSize.width);
66613
- const marginLeft = toNumber2(pageStyles.pageMargins?.left);
66614
- const marginRight = toNumber2(pageStyles.pageMargins?.right);
66615
- const pageAvailableWidthPx = Math.max((pageWidth - marginLeft - marginRight) * PIXELS_PER_INCH, 0);
66616
- if (pageAvailableWidthPx > 0) {
66617
- availableWidth = availableWidth ? Math.min(availableWidth, pageAvailableWidthPx) : pageAvailableWidthPx;
66618
- }
66619
- }
66620
66818
  const resolveColumnWidth = (colIndex2, colwidthValue) => {
66621
- if (overrideCol === colIndex2) return overrideValue;
66622
66819
  if (colwidthValue != null) return colwidthValue;
66623
66820
  if (gridColumns && gridColumns[colIndex2] != null) return gridColumns[colIndex2];
66624
66821
  return null;
66625
66822
  };
66626
66823
  const widths = [];
66627
- const row2 = node2.firstChild;
66824
+ const firstRow = node2.firstChild;
66628
66825
  let colIndex = 0;
66629
- if (row2 !== null) {
66630
- for (let i2 = 0; i2 < row2.childCount; i2++) {
66631
- const child = row2.child(i2);
66826
+ if (firstRow !== null) {
66827
+ for (let i2 = 0; i2 < firstRow.childCount; i2++) {
66828
+ const child = firstRow.child(i2);
66632
66829
  const { colspan, colwidth } = child.attrs;
66633
66830
  for (let span = 0; span < colspan; span += 1, colIndex += 1) {
66634
66831
  widths.push(resolveColumnWidth(colIndex, colwidth && colwidth[span]));
@@ -66648,49 +66845,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66648
66845
  if (numericWidth < 1) return 0;
66649
66846
  return numericWidth;
66650
66847
  });
66651
- const rawTotalWidth = normalizedWidths.reduce((sum, width) => sum + (width != null ? width : cellMinWidth2), 0);
66652
- let scale = 1;
66653
- if (availableWidth && rawTotalWidth > 0 && rawTotalWidth > availableWidth) {
66654
- scale = availableWidth / rawTotalWidth;
66655
- }
66656
- let totalWidth = 0;
66657
- let hasUndefinedWidth = false;
66658
- let dom = colgroup.firstChild;
66848
+ const tableWidthCSS = convertSizeToCSS(
66849
+ // TODO: why is tableWidth undefined in src/tests/import-export/font-default-styles.test.js?
66850
+ node2.attrs.tableProperties.tableWidth?.value ?? null,
66851
+ node2.attrs.tableProperties.tableWidth?.type ?? "auto"
66852
+ );
66853
+ let colElement = colgroup.firstChild;
66659
66854
  normalizedWidths.forEach((width) => {
66660
- let scaledWidth = width;
66661
- if (scaledWidth != null) {
66662
- scaledWidth = scaledWidth * scale;
66663
- }
66664
- const [propKey, propVal] = getColStyleDeclaration(cellMinWidth2, scaledWidth);
66665
- if (scaledWidth == null) {
66666
- totalWidth += cellMinWidth2;
66667
- hasUndefinedWidth = true;
66668
- } else {
66669
- totalWidth += scaledWidth;
66670
- }
66671
- if (!dom) {
66672
- const colElement = document.createElement("col");
66673
- colElement.style.setProperty(propKey, propVal);
66855
+ if (!colElement) {
66856
+ colElement = document.createElement("col");
66674
66857
  colgroup.appendChild(colElement);
66675
- } else {
66676
- dom.style.setProperty(propKey, propVal);
66677
- dom = dom.nextSibling;
66678
66858
  }
66859
+ colElement.style.width = width !== null && width !== void 0 ? `${width}px` : null;
66860
+ colElement = colElement.nextSibling;
66679
66861
  });
66680
- while (dom) {
66681
- const next2 = dom.nextSibling;
66682
- dom.parentNode?.removeChild(dom);
66683
- dom = next2;
66862
+ while (colElement) {
66863
+ const next2 = colElement.nextSibling;
66864
+ colElement.parentNode?.removeChild(colElement);
66865
+ colElement = next2;
66684
66866
  }
66685
- if (scale < 1 || !hasUndefinedWidth) {
66686
- const clampedWidth = Math.min(totalWidth, availableWidth || totalWidth);
66687
- table2.style.width = `${clampedWidth}px`;
66688
- table2.style.minWidth = "";
66867
+ const tableIndent = convertSizeToCSS(
66868
+ node2.attrs.tableProperties.tableIndent?.value ?? 0,
66869
+ node2.attrs.tableProperties.tableIndent?.type ?? "dxa"
66870
+ );
66871
+ const firstRowFirstCellPaddingLeftPx = firstRow?.firstChild?.attrs?.cellMargins?.left ?? 0;
66872
+ const firstRowLastCellPaddingRightPx = firstRow?.lastChild?.attrs?.cellMargins?.right ?? 0;
66873
+ table2.style.marginLeft = `${-firstRowFirstCellPaddingLeftPx}px`;
66874
+ if (tableIndent !== null) {
66875
+ table2.style.marginLeft = tableIndent;
66876
+ }
66877
+ if (node2.attrs.tableProperties.tableWidth?.type === "pct") {
66878
+ const padding = firstRowFirstCellPaddingLeftPx + firstRowLastCellPaddingRightPx;
66879
+ table2.style.maxWidth = table2.style.width = `calc(${tableWidthCSS} + ${padding}px)`;
66689
66880
  } else {
66690
- table2.style.width = "";
66691
- table2.style.minWidth = `${totalWidth}px`;
66881
+ table2.style.maxWidth = table2.style.width = tableWidthCSS;
66692
66882
  }
66693
- table2.style.maxWidth = "100%";
66694
66883
  }
66695
66884
  function updateTable(editor, node2, table2) {
66696
66885
  const allExtensionsAttrs = editor.extensionService.attributes;
@@ -66768,6 +66957,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66768
66957
  const tableBorders = createTableBorders();
66769
66958
  return types2.table.createChecked({ borders: tableBorders }, rows);
66770
66959
  };
66960
+ const getColStyleDeclaration = (minWidth, width) => {
66961
+ if (width != null) {
66962
+ const numericWidth = Number(width);
66963
+ if (Number.isFinite(numericWidth) && numericWidth >= 0) {
66964
+ return ["width", `${numericWidth}px`];
66965
+ }
66966
+ }
66967
+ return ["min-width", `${minWidth}px`];
66968
+ };
66771
66969
  const MIN_MEANINGFUL_WIDTH_PX = 1;
66772
66970
  const createColGroup = (node2, cellMinWidth2, overrideCol, overrideValue) => {
66773
66971
  let totalWidth = 0;
@@ -69134,15 +69332,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69134
69332
  },
69135
69333
  addAttributes() {
69136
69334
  return {
69137
- /* tableWidth: {
69138
- renderDOM: ({ tableWidth }) => {
69139
- if (!tableWidth) return {};
69140
- const { width, type = 'auto' } = tableWidth;
69141
- return {
69142
- style: `width: ${width}px`
69143
- };
69144
- },
69145
- }, */
69146
69335
  /**
69147
69336
  * @private
69148
69337
  * @category Attribute
@@ -69246,7 +69435,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69246
69435
  * @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 371-483
69247
69436
  */
69248
69437
  tableProperties: {
69249
- default: null,
69438
+ default: {
69439
+ tableWidth: {
69440
+ value: null,
69441
+ type: "auto"
69442
+ }
69443
+ },
69250
69444
  rendered: false
69251
69445
  },
69252
69446
  /**
@@ -70014,12 +70208,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70014
70208
  }
70015
70209
  },
70016
70210
  cellMargins: {
70017
- renderDOM({ cellMargins }) {
70211
+ renderDOM({ cellMargins, borders }) {
70018
70212
  if (!cellMargins) return {};
70019
70213
  const sides2 = ["top", "right", "bottom", "left"];
70020
70214
  const style2 = sides2.map((side) => {
70021
- const margin = cellMargins?.[side];
70022
- if (margin) return `padding-${side}: ${margin}px;`;
70215
+ const margin = cellMargins?.[side] ?? 0;
70216
+ const border = borders?.[side];
70217
+ const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
70218
+ if (margin) return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
70023
70219
  return "";
70024
70220
  }).join(" ");
70025
70221
  return { style: style2 };
@@ -99214,7 +99410,7 @@ ${style2}
99214
99410
  };
99215
99411
  }
99216
99412
  };
99217
- const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-cd3558fe"]]);
99413
+ const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-4615ea7d"]]);
99218
99414
  const _hoisted_1$h = ["innerHTML"];
99219
99415
  const _sfc_main$i = {
99220
99416
  __name: "SuperInput",
@@ -116630,7 +116826,7 @@ ${style2}
116630
116826
  this.config.colors = shuffleArray(this.config.colors);
116631
116827
  this.userColorMap = /* @__PURE__ */ new Map();
116632
116828
  this.colorIndex = 0;
116633
- this.version = "0.31.0-next.5";
116829
+ this.version = "0.31.0-next.7";
116634
116830
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
116635
116831
  this.superdocId = config2.superdocId || v4();
116636
116832
  this.colors = this.config.colors;
@@ -119030,7 +119226,7 @@ ${style2}
119030
119226
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
119031
119227
  );
119032
119228
  }
119033
- const indexB7dCHQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119229
+ const indexBJ6cOegF = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
119034
119230
  __proto__: null,
119035
119231
  unified
119036
119232
  }, Symbol.toStringTag, { value: "Module" }));