superdoc 1.0.0-beta.10 → 1.0.0-beta.12

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 (29) hide show
  1. package/dist/chunks/{PdfViewer--YMlVUNN.es.js → PdfViewer-BL2O6Y4C.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-H8A08hnq.cjs → PdfViewer-CWb8_m3N.cjs} +1 -1
  3. package/dist/chunks/{index-B7kE5mis.cjs → index-ANaY3G41.cjs} +3 -3
  4. package/dist/chunks/{index-BrS4iO03.es.js → index-Bs29IidK.es.js} +3 -3
  5. package/dist/chunks/{index-CC6Vsniy-D24AMjnI.cjs → index-Cha-6AFg-28WIXlKN.cjs} +1 -1
  6. package/dist/chunks/{index-CC6Vsniy-En79I7vb.es.js → index-Cha-6AFg-3WCQFN4m.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-C3Mtq3FL.es.js → super-editor.es-C-5T9RJI.es.js} +214 -73
  8. package/dist/chunks/{super-editor.es-Bf7zv4k5.cjs → super-editor.es-CBMp55sv.cjs} +214 -73
  9. package/dist/style.css +6 -6
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-xQmDrmCk.js → converter-B4P0mjU2.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-BKkVPA0E.js → docx-zipper-D5Do5rOh.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-C0RiU_sq.js → editor-CoLzF_z4.js} +171 -55
  14. package/dist/super-editor/chunks/{index-CC6Vsniy.js → index-Cha-6AFg.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-BznN8wrp.js → toolbar-Bt8ifcaq.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 +2 -2
  20. package/dist/super-editor/style.css +6 -6
  21. package/dist/super-editor/super-editor.es.js +49 -24
  22. package/dist/super-editor/toolbar.es.js +2 -2
  23. package/dist/super-editor.cjs +1 -1
  24. package/dist/super-editor.es.js +1 -1
  25. package/dist/superdoc.cjs +2 -2
  26. package/dist/superdoc.es.js +2 -2
  27. package/dist/superdoc.umd.js +216 -75
  28. package/dist/superdoc.umd.js.map +1 -1
  29. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, z as h, O as Transition, $ as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-CztqUvm1.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-BrS4iO03.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-Bs29IidK.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-ARQSyfaw.cjs");
4
- const superdoc = require("./index-B7kE5mis.cjs");
4
+ const superdoc = require("./index-ANaY3G41.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-Bf7zv4k5.cjs");
2
+ const superEditor_es = require("./super-editor.es-CBMp55sv.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-CFCpOk3d.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17227,7 +17227,7 @@ const _sfc_main = {
17227
17227
  __name: "SuperDoc",
17228
17228
  emits: ["selection-update"],
17229
17229
  setup(__props, { emit: __emit }) {
17230
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-H8A08hnq.cjs")));
17230
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CWb8_m3N.cjs")));
17231
17231
  const superdocStore = useSuperdocStore();
17232
17232
  const commentsStore = useCommentsStore();
17233
17233
  const {
@@ -18080,7 +18080,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18080
18080
  this.config.colors = shuffleArray(this.config.colors);
18081
18081
  this.userColorMap = /* @__PURE__ */ new Map();
18082
18082
  this.colorIndex = 0;
18083
- this.version = "1.0.0-beta.10";
18083
+ this.version = "1.0.0-beta.12";
18084
18084
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18085
18085
  this.superdocId = config.superdocId || uuid.v4();
18086
18086
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-C3Mtq3FL.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-C-5T9RJI.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-ByBH0NYV.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17210,7 +17210,7 @@ const _sfc_main = {
17210
17210
  __name: "SuperDoc",
17211
17211
  emits: ["selection-update"],
17212
17212
  setup(__props, { emit: __emit }) {
17213
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer--YMlVUNN.es.js"));
17213
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BL2O6Y4C.es.js"));
17214
17214
  const superdocStore = useSuperdocStore();
17215
17215
  const commentsStore = useCommentsStore();
17216
17216
  const {
@@ -18063,7 +18063,7 @@ class SuperDoc extends EventEmitter {
18063
18063
  this.config.colors = shuffleArray(this.config.colors);
18064
18064
  this.userColorMap = /* @__PURE__ */ new Map();
18065
18065
  this.colorIndex = 0;
18066
- this.version = "1.0.0-beta.10";
18066
+ this.version = "1.0.0-beta.12";
18067
18067
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18068
18068
  this.superdocId = config.superdocId || v4();
18069
18069
  this.colors = this.config.colors;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-Bf7zv4k5.cjs");
3
+ const superEditor_es = require("./super-editor.es-CBMp55sv.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-C3Mtq3FL.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-C-5T9RJI.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -35588,7 +35588,7 @@ const _SuperConverter = class _SuperConverter2 {
35588
35588
  static getStoredSuperdocVersion(docx) {
35589
35589
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35590
35590
  }
35591
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.10") {
35591
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.12") {
35592
35592
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35593
35593
  }
35594
35594
  /**
@@ -52295,7 +52295,7 @@ const isHeadless = (editor) => {
52295
52295
  const shouldSkipNodeView = (editor) => {
52296
52296
  return isHeadless(editor);
52297
52297
  };
52298
- const summaryVersion = "1.0.0-beta.10";
52298
+ const summaryVersion = "1.0.0-beta.12";
52299
52299
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
52300
52300
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
52301
52301
  function mapAttributes(attrs) {
@@ -53074,7 +53074,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53074
53074
  { default: remarkStringify },
53075
53075
  { default: remarkGfm }
53076
53076
  ] = await Promise.all([
53077
- import("./index-CC6Vsniy-En79I7vb.es.js"),
53077
+ import("./index-Cha-6AFg-3WCQFN4m.es.js"),
53078
53078
  import("./index-DRCvimau-Cw339678.es.js"),
53079
53079
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
53080
53080
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -53279,7 +53279,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53279
53279
  * Process collaboration migrations
53280
53280
  */
53281
53281
  processCollaborationMigrations() {
53282
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.10");
53282
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.12");
53283
53283
  if (!this.options.ydoc) return;
53284
53284
  const metaMap = this.options.ydoc.getMap("meta");
53285
53285
  let docVersion = metaMap.get("version");
@@ -57380,28 +57380,42 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
57380
57380
  const indentSource = attrs.indent ?? paragraphProps.indent ?? hydrated?.indent;
57381
57381
  const normalizedIndent = normalizePxIndent(indentSource) ?? normalizeParagraphIndent(indentSource ?? attrs.textIndent);
57382
57382
  const unwrapTabStops = (tabStops) => {
57383
- if (!Array.isArray(tabStops)) return void 0;
57383
+ if (!Array.isArray(tabStops)) {
57384
+ return void 0;
57385
+ }
57384
57386
  const unwrapped = [];
57385
57387
  for (const entry of tabStops) {
57386
- if (entry && typeof entry === "object" && "tab" in entry) {
57387
- const tab = entry.tab;
57388
- if (tab && typeof tab === "object") {
57389
- const tabObj = tab;
57390
- const val = typeof tabObj.tabType === "string" ? tabObj.tabType : typeof tabObj.val === "string" ? tabObj.val : void 0;
57391
- const pos = pickNumber(tabObj.originalPos ?? tabObj.pos);
57392
- if (val && pos != null) {
57393
- const normalized = { val, pos };
57394
- const leader = tabObj.leader;
57395
- if (typeof leader === "string") normalized.leader = leader;
57396
- const originalPos = pickNumber(tabObj.originalPos);
57397
- if (originalPos != null) normalized.originalPos = originalPos;
57398
- unwrapped.push(normalized);
57399
- continue;
57400
- }
57388
+ if (!entry || typeof entry !== "object") {
57389
+ continue;
57390
+ }
57391
+ if ("tab" in entry) {
57392
+ const entryRecord2 = entry;
57393
+ const tab = entryRecord2.tab;
57394
+ if (!tab || typeof tab !== "object") {
57395
+ continue;
57401
57396
  }
57397
+ const tabObj = tab;
57398
+ const val = typeof tabObj.tabType === "string" ? tabObj.tabType : typeof tabObj.val === "string" ? tabObj.val : void 0;
57399
+ const pos = pickNumber(tabObj.originalPos ?? tabObj.pos);
57400
+ if (!val || pos == null) {
57401
+ continue;
57402
+ }
57403
+ const normalized = { val, pos };
57404
+ const leader = tabObj.leader;
57405
+ if (typeof leader === "string" && leader.length > 0) {
57406
+ normalized.leader = leader;
57407
+ }
57408
+ const originalPos = pickNumber(tabObj.originalPos);
57409
+ if (originalPos != null && Number.isFinite(originalPos)) {
57410
+ normalized.originalPos = originalPos;
57411
+ }
57412
+ unwrapped.push(normalized);
57413
+ continue;
57402
57414
  }
57403
- if (entry && typeof entry === "object") {
57404
- unwrapped.push(entry);
57415
+ const entryRecord = entry;
57416
+ const hasValidStructure = ("val" in entryRecord || "tabType" in entryRecord) && ("pos" in entryRecord || "originalPos" in entryRecord);
57417
+ if (hasValidStructure) {
57418
+ unwrapped.push(entryRecord);
57405
57419
  }
57406
57420
  }
57407
57421
  return unwrapped.length > 0 ? unwrapped : void 0;
@@ -65236,7 +65250,7 @@ const resolveTableCellBorders = (tableBorders, rowIndex, colIndex, totalRows, to
65236
65250
  };
65237
65251
  };
65238
65252
  const renderTableCell = (deps) => {
65239
- const { doc: doc2, x: x2, y: y2, rowHeight, cellMeasure, cell, borders, useDefaultBorder, renderLine, context, applySdtDataset } = deps;
65253
+ const { doc: doc2, x: x2, y: y2, rowHeight, cellMeasure, cell, borders, renderLine, context, applySdtDataset } = deps;
65240
65254
  const cellEl = doc2.createElement("div");
65241
65255
  cellEl.style.position = "absolute";
65242
65256
  cellEl.style.left = `${x2}px`;
@@ -65246,8 +65260,6 @@ const renderTableCell = (deps) => {
65246
65260
  cellEl.style.boxSizing = "border-box";
65247
65261
  if (borders) {
65248
65262
  applyCellBorders(cellEl, borders);
65249
- } else if (useDefaultBorder) {
65250
- cellEl.style.border = "1px solid rgba(0,0,0,0.6)";
65251
65263
  }
65252
65264
  if (cell?.attrs?.background) {
65253
65265
  cellEl.style.backgroundColor = cell.attrs.background;
@@ -65289,25 +65301,55 @@ const renderTableRow = (deps) => {
65289
65301
  row,
65290
65302
  totalRows,
65291
65303
  tableBorders,
65304
+ columnWidths,
65305
+ allRowHeights,
65292
65306
  context,
65293
65307
  renderLine,
65294
65308
  applySdtDataset
65295
65309
  } = deps;
65296
- let x2 = 0;
65310
+ const calculateXPosition = (gridColumnStart) => {
65311
+ let x2 = 0;
65312
+ for (let i = 0; i < gridColumnStart && i < columnWidths.length; i++) {
65313
+ x2 += columnWidths[i];
65314
+ }
65315
+ return x2;
65316
+ };
65317
+ const calculateRowspanHeight = (startRowIndex, rowSpan) => {
65318
+ let totalHeight = 0;
65319
+ for (let i = 0; i < rowSpan && startRowIndex + i < allRowHeights.length; i++) {
65320
+ totalHeight += allRowHeights[startRowIndex + i];
65321
+ }
65322
+ return totalHeight;
65323
+ };
65297
65324
  for (let cellIndex = 0; cellIndex < rowMeasure.cells.length; cellIndex += 1) {
65298
65325
  const cellMeasure = rowMeasure.cells[cellIndex];
65299
65326
  const cell = row?.cells?.[cellIndex];
65300
- const hasExplicitBorders = Boolean(cell?.attrs?.borders);
65301
- const resolvedBorders = hasExplicitBorders ? cell?.attrs?.borders : tableBorders ? resolveTableCellBorders(tableBorders, rowIndex, cellIndex, totalRows, rowMeasure.cells.length) : void 0;
65327
+ const x2 = cellMeasure.gridColumnStart != null ? calculateXPosition(cellMeasure.gridColumnStart) : cellIndex === 0 ? 0 : calculateXPosition(cellIndex);
65328
+ const cellBordersAttr = cell?.attrs?.borders;
65329
+ const hasBordersAttribute = cellBordersAttr !== void 0;
65330
+ const hasExplicitBorders = hasBordersAttribute && cellBordersAttr && (cellBordersAttr.top !== void 0 || cellBordersAttr.right !== void 0 || cellBordersAttr.bottom !== void 0 || cellBordersAttr.left !== void 0);
65331
+ const gridColIndex = cellMeasure.gridColumnStart ?? cellIndex;
65332
+ const totalCols = columnWidths.length;
65333
+ let resolvedBorders;
65334
+ if (hasExplicitBorders) {
65335
+ resolvedBorders = cellBordersAttr;
65336
+ } else if (hasBordersAttribute) {
65337
+ resolvedBorders = void 0;
65338
+ } else if (tableBorders) {
65339
+ resolvedBorders = resolveTableCellBorders(tableBorders, rowIndex, gridColIndex, totalRows, totalCols);
65340
+ } else {
65341
+ resolvedBorders = void 0;
65342
+ }
65343
+ const rowSpan = cellMeasure.rowSpan ?? 1;
65344
+ const cellHeight = rowSpan > 1 ? calculateRowspanHeight(rowIndex, rowSpan) : rowMeasure.height;
65302
65345
  const { cellElement, contentElement } = renderTableCell({
65303
65346
  doc: doc2,
65304
65347
  x: x2,
65305
65348
  y: y2,
65306
- rowHeight: rowMeasure.height,
65349
+ rowHeight: cellHeight,
65307
65350
  cellMeasure,
65308
65351
  cell,
65309
65352
  borders: resolvedBorders,
65310
- useDefaultBorder: !hasExplicitBorders && !tableBorders,
65311
65353
  renderLine,
65312
65354
  context,
65313
65355
  applySdtDataset
@@ -65316,7 +65358,6 @@ const renderTableRow = (deps) => {
65316
65358
  if (contentElement) {
65317
65359
  container.appendChild(contentElement);
65318
65360
  }
65319
- x2 += cellMeasure.width;
65320
65361
  }
65321
65362
  };
65322
65363
  const renderTableFragment = (deps) => {
@@ -65358,6 +65399,45 @@ const renderTableFragment = (deps) => {
65358
65399
  applySdtDataset(container, block.attrs?.sdt);
65359
65400
  container.classList.add("superdoc-table-fragment");
65360
65401
  if (fragment.metadata?.columnBoundaries) {
65402
+ const columnCount = measure.columnWidths.length;
65403
+ const rowCount = block.rows.length;
65404
+ const boundarySegments = [];
65405
+ for (let i = 0; i < columnCount; i++) {
65406
+ boundarySegments.push([]);
65407
+ }
65408
+ let rowY = 0;
65409
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
65410
+ const rowMeasure = measure.rows[rowIndex];
65411
+ if (!rowMeasure) continue;
65412
+ const boundariesInRow = /* @__PURE__ */ new Set();
65413
+ for (const cellMeasure of rowMeasure.cells) {
65414
+ const startCol = cellMeasure.gridColumnStart ?? 0;
65415
+ const colSpan = cellMeasure.colSpan ?? 1;
65416
+ const endCol = startCol + colSpan;
65417
+ if (startCol > 0) {
65418
+ boundariesInRow.add(startCol);
65419
+ }
65420
+ if (endCol < columnCount) {
65421
+ boundariesInRow.add(endCol);
65422
+ }
65423
+ }
65424
+ for (const boundaryCol of boundariesInRow) {
65425
+ const segments = boundarySegments[boundaryCol];
65426
+ const lastSegment = segments[segments.length - 1];
65427
+ if (lastSegment && lastSegment.toRow === rowIndex) {
65428
+ lastSegment.toRow = rowIndex + 1;
65429
+ lastSegment.height += rowMeasure.height;
65430
+ } else {
65431
+ segments.push({
65432
+ fromRow: rowIndex,
65433
+ toRow: rowIndex + 1,
65434
+ y: rowY,
65435
+ height: rowMeasure.height
65436
+ });
65437
+ }
65438
+ }
65439
+ rowY += rowMeasure.height;
65440
+ }
65361
65441
  const metadata = {
65362
65442
  columns: fragment.metadata.columnBoundaries.map((boundary) => ({
65363
65443
  i: boundary.index,
@@ -65365,7 +65445,18 @@ const renderTableFragment = (deps) => {
65365
65445
  w: boundary.width,
65366
65446
  min: boundary.minWidth,
65367
65447
  r: boundary.resizable ? 1 : 0
65368
- }))
65448
+ })),
65449
+ // Add segments for each column boundary (segments where resize handle should appear)
65450
+ segments: boundarySegments.map(
65451
+ (segs, colIndex) => segs.map((seg) => ({
65452
+ c: colIndex,
65453
+ // column index
65454
+ y: seg.y,
65455
+ // y position
65456
+ h: seg.height
65457
+ // height of segment
65458
+ }))
65459
+ )
65369
65460
  };
65370
65461
  container.setAttribute("data-table-boundaries", JSON.stringify(metadata));
65371
65462
  }
@@ -65376,6 +65467,7 @@ const renderTableFragment = (deps) => {
65376
65467
  if (borderCollapse === "separate" && block.attrs?.cellSpacing) {
65377
65468
  container.style.borderSpacing = `${block.attrs.cellSpacing}px`;
65378
65469
  }
65470
+ const allRowHeights = measure.rows.map((r2) => r2.height);
65379
65471
  let y2 = 0;
65380
65472
  for (let r2 = fragment.fromRow; r2 < fragment.toRow; r2 += 1) {
65381
65473
  const rowMeasure = measure.rows[r2];
@@ -65389,6 +65481,8 @@ const renderTableFragment = (deps) => {
65389
65481
  row: block.rows[r2],
65390
65482
  totalRows: block.rows.length,
65391
65483
  tableBorders,
65484
+ columnWidths: measure.columnWidths,
65485
+ allRowHeights,
65392
65486
  context,
65393
65487
  renderLine,
65394
65488
  applySdtDataset
@@ -68030,21 +68124,9 @@ async function measureParagraphBlock(block, maxWidth) {
68030
68124
  }
68031
68125
  async function measureTableBlock(block, constraints) {
68032
68126
  const maxWidth = typeof constraints === "number" ? constraints : constraints.maxWidth;
68033
- const columnCount = Math.max(1, Math.max(...block.rows.map((r2) => r2.cells.length)));
68034
68127
  let columnWidths;
68035
68128
  if (block.columnWidths && block.columnWidths.length > 0) {
68036
68129
  columnWidths = [...block.columnWidths];
68037
- if (columnWidths.length < columnCount) {
68038
- const usedWidth = columnWidths.reduce((a, b2) => a + b2, 0);
68039
- const remainingWidth = Math.max(0, maxWidth - usedWidth);
68040
- const missingCount = columnCount - columnWidths.length;
68041
- const defaultWidth = missingCount > 0 ? Math.max(1, Math.floor(remainingWidth / missingCount)) : 0;
68042
- for (let i = columnWidths.length; i < columnCount; i++) {
68043
- columnWidths.push(defaultWidth);
68044
- }
68045
- } else if (columnWidths.length > columnCount) {
68046
- columnWidths = columnWidths.slice(0, columnCount);
68047
- }
68048
68130
  const totalWidth2 = columnWidths.reduce((a, b2) => a + b2, 0);
68049
68131
  const hasExplicitWidth = block.attrs?.tableWidth != null;
68050
68132
  if (!hasExplicitWidth && totalWidth2 > maxWidth) {
@@ -68052,22 +68134,56 @@ async function measureTableBlock(block, constraints) {
68052
68134
  columnWidths = columnWidths.map((w2) => Math.max(1, Math.floor(w2 * scale)));
68053
68135
  }
68054
68136
  } else {
68055
- const columnWidth = Math.max(1, Math.floor(maxWidth / columnCount));
68056
- columnWidths = Array.from({ length: columnCount }, () => columnWidth);
68137
+ const maxCellCount = Math.max(1, Math.max(...block.rows.map((r2) => r2.cells.length)));
68138
+ const columnWidth = Math.max(1, Math.floor(maxWidth / maxCellCount));
68139
+ columnWidths = Array.from({ length: maxCellCount }, () => columnWidth);
68057
68140
  }
68141
+ const gridColumnCount = columnWidths.length;
68142
+ const calculateCellWidth = (startCol, colspan) => {
68143
+ let width = 0;
68144
+ for (let i = 0; i < colspan && startCol + i < columnWidths.length; i++) {
68145
+ width += columnWidths[startCol + i];
68146
+ }
68147
+ return Math.max(1, width);
68148
+ };
68149
+ const rowspanTracker = new Array(gridColumnCount).fill(0);
68058
68150
  const rows = [];
68059
- for (const row of block.rows) {
68151
+ for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex++) {
68152
+ const row = block.rows[rowIndex];
68060
68153
  const cellMeasures = [];
68061
- for (let col = 0; col < columnCount; col++) {
68062
- const cell = row.cells[col];
68063
- const cellWidth = columnWidths[col] || columnWidths[0] || Math.floor(maxWidth / columnCount);
68064
- if (!cell) {
68065
- cellMeasures.push({ paragraph: { kind: "paragraph", lines: [], totalHeight: 0 }, width: cellWidth, height: 0 });
68066
- continue;
68154
+ let gridColIndex = 0;
68155
+ for (const cell of row.cells) {
68156
+ const colspan = cell.colSpan ?? 1;
68157
+ const rowspan = cell.rowSpan ?? 1;
68158
+ while (gridColIndex < gridColumnCount && rowspanTracker[gridColIndex] > 0) {
68159
+ rowspanTracker[gridColIndex]--;
68160
+ gridColIndex++;
68161
+ }
68162
+ if (gridColIndex >= gridColumnCount) {
68163
+ break;
68164
+ }
68165
+ const cellWidth = calculateCellWidth(gridColIndex, colspan);
68166
+ if (rowspan > 1) {
68167
+ for (let c2 = 0; c2 < colspan && gridColIndex + c2 < gridColumnCount; c2++) {
68168
+ rowspanTracker[gridColIndex + c2] = rowspan - 1;
68169
+ }
68067
68170
  }
68068
68171
  const paraMeasure = await measureParagraphBlock(cell.paragraph, cellWidth);
68069
68172
  const height = paraMeasure.totalHeight;
68070
- cellMeasures.push({ paragraph: paraMeasure, width: cellWidth, height });
68173
+ cellMeasures.push({
68174
+ paragraph: paraMeasure,
68175
+ width: cellWidth,
68176
+ height,
68177
+ gridColumnStart: gridColIndex,
68178
+ colSpan: colspan,
68179
+ rowSpan: rowspan
68180
+ });
68181
+ gridColIndex += colspan;
68182
+ }
68183
+ for (let col = gridColIndex; col < gridColumnCount; col++) {
68184
+ if (rowspanTracker[col] > 0) {
68185
+ rowspanTracker[col]--;
68186
+ }
68071
68187
  }
68072
68188
  const rowHeight = Math.max(0, ...cellMeasures.map((c2) => c2.height));
68073
68189
  rows.push({ cells: cellMeasures, height: rowHeight });
@@ -101258,7 +101374,7 @@ async function createZip(blobs, fileNames) {
101258
101374
  blobs.forEach((blob, index2) => {
101259
101375
  zip.file(fileNames[index2], blob);
101260
101376
  });
101261
- const zipBlob = await zip.generateAsync({ type: "blob" });
101377
+ const zipBlob = await zip.generateAsync({ type: "blob", compression: "DEFLATE" });
101262
101378
  return zipBlob;
101263
101379
  }
101264
101380
  var __defProp = Object.defineProperty;
@@ -106114,13 +106230,31 @@ const _sfc_main$2 = {
106114
106230
  });
106115
106231
  return boundaries;
106116
106232
  });
106117
- function getHandleStyle(boundary) {
106233
+ function getBoundarySegments(boundary) {
106234
+ if (boundary.type === "right-edge") {
106235
+ return [{ y: 0, h: null }];
106236
+ }
106237
+ const segmentsData = tableMetadata.value?.segments;
106238
+ if (!segmentsData || !Array.isArray(segmentsData)) {
106239
+ return [{ y: 0, h: null }];
106240
+ }
106241
+ const boundaryColIndex = boundary.index + 1;
106242
+ const colSegments = segmentsData[boundaryColIndex];
106243
+ if (!colSegments || colSegments.length === 0) {
106244
+ return [];
106245
+ }
106246
+ return colSegments.map((seg) => ({
106247
+ y: seg.y,
106248
+ h: seg.h
106249
+ }));
106250
+ }
106251
+ function getSegmentHandleStyle(boundary, segment) {
106118
106252
  return {
106119
106253
  position: "absolute",
106120
106254
  left: `${boundary.x}px`,
106121
- top: "0",
106255
+ top: segment.y != null ? `${segment.y}px` : "0",
106122
106256
  width: "9px",
106123
- height: "100%",
106257
+ height: segment.h != null ? `${segment.h}px` : "100%",
106124
106258
  transform: "translateX(-4px)",
106125
106259
  cursor: "col-resize",
106126
106260
  pointerEvents: "auto"
@@ -106175,7 +106309,8 @@ const _sfc_main$2 = {
106175
106309
  });
106176
106310
  return;
106177
106311
  }
106178
- tableMetadata.value = { columns: validatedColumns };
106312
+ const segments = Array.isArray(parsed.segments) ? parsed.segments : void 0;
106313
+ tableMetadata.value = { columns: validatedColumns, segments };
106179
106314
  } catch (error) {
106180
106315
  tableMetadata.value = null;
106181
106316
  emit("resize-error", {
@@ -106337,7 +106472,7 @@ const _sfc_main$2 = {
106337
106472
  updateCellColwidths(tr, tableNode, tablePos, affectedColumns, newWidths);
106338
106473
  dispatch(tr);
106339
106474
  const blockId = props.tableElement?.getAttribute("data-sd-block-id");
106340
- if (blockId) {
106475
+ if (blockId && blockId.trim()) {
106341
106476
  measureCache.invalidate([blockId]);
106342
106477
  }
106343
106478
  emit("resize-success", { columnIndex, newWidths });
@@ -106440,18 +106575,24 @@ const _sfc_main$2 = {
106440
106575
  onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
106441
106576
  }, ["stop"]))
106442
106577
  }, [
106443
- (openBlock(true), createElementBlock(Fragment$1, null, renderList(resizableBoundaries.value, (boundary, index2) => {
106444
- return openBlock(), createElementBlock("div", {
106445
- key: `handle-${boundary.type}-${boundary.index}`,
106446
- class: normalizeClass(["resize-handle", {
106447
- "resize-handle--active": dragState.value && dragState.value.boundaryIndex === index2,
106448
- "resize-handle--edge": boundary.type === "right-edge"
106449
- }]),
106450
- "data-boundary-index": index2,
106451
- "data-boundary-type": boundary.type,
106452
- style: normalizeStyle(getHandleStyle(boundary)),
106453
- onMousedown: ($event) => onHandleMouseDown($event, index2)
106454
- }, null, 46, _hoisted_1$2);
106578
+ (openBlock(true), createElementBlock(Fragment$1, null, renderList(resizableBoundaries.value, (boundary, boundaryIndex) => {
106579
+ return openBlock(), createElementBlock(Fragment$1, {
106580
+ key: `boundary-${boundaryIndex}`
106581
+ }, [
106582
+ (openBlock(true), createElementBlock(Fragment$1, null, renderList(getBoundarySegments(boundary), (segment, segmentIndex) => {
106583
+ return openBlock(), createElementBlock("div", {
106584
+ key: `handle-${boundary.type}-${boundary.index}-${segmentIndex}`,
106585
+ class: normalizeClass(["resize-handle", {
106586
+ "resize-handle--active": dragState.value && dragState.value.boundaryIndex === boundaryIndex,
106587
+ "resize-handle--edge": boundary.type === "right-edge"
106588
+ }]),
106589
+ "data-boundary-index": boundaryIndex,
106590
+ "data-boundary-type": boundary.type,
106591
+ style: normalizeStyle(getSegmentHandleStyle(boundary, segment)),
106592
+ onMousedown: ($event) => onHandleMouseDown($event, boundaryIndex)
106593
+ }, null, 46, _hoisted_1$2);
106594
+ }), 128))
106595
+ ], 64);
106455
106596
  }), 128)),
106456
106597
  dragState.value ? (openBlock(), createElementBlock("div", {
106457
106598
  key: 0,
@@ -106462,7 +106603,7 @@ const _sfc_main$2 = {
106462
106603
  };
106463
106604
  }
106464
106605
  };
106465
- const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-acc51d8d"]]);
106606
+ const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d4258885"]]);
106466
106607
  function adjustPaginationBreaks(editorElem, editor) {
106467
106608
  if (!editorElem.value || !editor?.value?.options?.scale || isHeadless(editor)) return;
106468
106609
  const zoom = editor.value.options.scale;