oasis-editor 0.0.178 → 0.0.180

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.
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
2863
2863
  onCleanup(() => {
2864
2864
  cancelled = true;
2865
2865
  });
2866
- import("./OasisEditorApp-Bf9zCPBd.js").then((m) => {
2866
+ import("./OasisEditorApp-h2nQFM-y.js").then((m) => {
2867
2867
  cancelled = true;
2868
2868
  setProgress(1);
2869
2869
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -37826,6 +37826,11 @@ function getTableCellColSpan(cellProperties) {
37826
37826
  const parsed = value2 ? Number(value2) : 1;
37827
37827
  return Number.isFinite(parsed) && parsed > 1 ? Math.floor(parsed) : 1;
37828
37828
  }
37829
+ function parseTrackedVerticalMergeValue(value2) {
37830
+ if (value2 === "rest" || value2 === "restart") return "restart";
37831
+ if (value2 === "cont" || value2 === "continue") return "continue";
37832
+ return void 0;
37833
+ }
37829
37834
  function getTableCellVMerge(cellProperties) {
37830
37835
  if (!cellProperties) {
37831
37836
  return void 0;
@@ -37964,15 +37969,13 @@ function parseTableCellStyle(cellProperties, tableDefaultMargins, colors) {
37964
37969
  const merged = getFirstChildByTagNameNS(cellProperties, WORD_NS$3, "cellMerge");
37965
37970
  const structural = inserted ?? deleted ?? merged;
37966
37971
  if (structural) {
37967
- const originalMerge = getAttributeValue(structural, "vMergeOrig");
37972
+ const originalMerge = parseTrackedVerticalMergeValue(
37973
+ getAttributeValue(structural, "vMergeOrig")
37974
+ );
37968
37975
  style2.revision = {
37969
37976
  ...parseRevisionMetadata(structural),
37970
37977
  type: inserted ? "insert" : deleted ? "delete" : "merge",
37971
- ...merged && originalMerge ? {
37972
- previous: {
37973
- vMerge: originalMerge === "restart" ? "restart" : "continue"
37974
- }
37975
- } : {}
37978
+ ...merged && originalMerge ? { previous: { vMerge: originalMerge } } : {}
37976
37979
  };
37977
37980
  }
37978
37981
  for (const [key, border] of Object.entries(
@@ -41049,6 +41052,27 @@ function applyCellParagraphAutospacing(cellNode, blocks) {
41049
41052
  )
41050
41053
  );
41051
41054
  }
41055
+ function captureTrackedCellMergeState(cell) {
41056
+ var _a2, _b2;
41057
+ const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
41058
+ const previousVMerge = (revision == null ? void 0 : revision.type) === "merge" ? (_b2 = revision.previous) == null ? void 0 : _b2.vMerge : void 0;
41059
+ if (!revision || revision.type !== "merge" || !previousVMerge) return;
41060
+ const previousStyle = cell.style ? { ...cell.style, revision: void 0 } : void 0;
41061
+ const previousCell = {
41062
+ ...cell,
41063
+ blocks: previousVMerge === "continue" ? [] : cell.blocks,
41064
+ vMerge: previousVMerge,
41065
+ rowSpan: void 0,
41066
+ style: previousStyle,
41067
+ mergeRevisionState: void 0
41068
+ };
41069
+ cell.mergeRevisionState = {
41070
+ revisionId: revision.id,
41071
+ orientation: "vertical",
41072
+ currentCellCount: 1,
41073
+ previousCells: [previousCell]
41074
+ };
41075
+ }
41052
41076
  async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, _styles) {
41053
41077
  var _a2, _b2;
41054
41078
  const gridCols = [];
@@ -41118,6 +41142,7 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
41118
41142
  }
41119
41143
  const cellExtAttrs = collectExtAttributes(cellNode);
41120
41144
  if (cellExtAttrs) cell.extAttributes = cellExtAttrs;
41145
+ captureTrackedCellMergeState(cell);
41121
41146
  if (vMerge === "continue") {
41122
41147
  cell.blocks = [];
41123
41148
  }
@@ -47989,7 +48014,7 @@ async function importDocxInWorker(buffer, options = {}) {
47989
48014
  const worker = new Worker(
47990
48015
  new URL(
47991
48016
  /* @vite-ignore */
47992
- "" + new URL("assets/importDocxWorker-BPMw_A0Z.js", import.meta.url).href,
48017
+ "" + new URL("assets/importDocxWorker-CTxcTGME.js", import.meta.url).href,
47993
48018
  import.meta.url
47994
48019
  ),
47995
48020
  {
@@ -52295,6 +52320,25 @@ function resolveRowStructuralRevision(row, path, context2) {
52295
52320
  style: row.style ? { ...row.style, revision: void 0 } : row.style
52296
52321
  };
52297
52322
  }
52323
+ function restoreVerticalCellMerge(cell) {
52324
+ var _a2, _b2;
52325
+ const state = cell.mergeRevisionState;
52326
+ if ((state == null ? void 0 : state.orientation) === "vertical" && state.currentCellCount === 1 && state.previousCells.length === 1) {
52327
+ return structuredClone(state.previousCells[0]);
52328
+ }
52329
+ const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
52330
+ if ((revision == null ? void 0 : revision.type) === "merge" && ((_b2 = revision.previous) == null ? void 0 : _b2.vMerge) === "continue") {
52331
+ return {
52332
+ ...cell,
52333
+ blocks: [],
52334
+ rowSpan: void 0,
52335
+ vMerge: "continue",
52336
+ style: cell.style ? { ...cell.style, revision: void 0 } : cell.style,
52337
+ mergeRevisionState: void 0
52338
+ };
52339
+ }
52340
+ return void 0;
52341
+ }
52298
52342
  function resolveCellStructuralRevision(cell, path, context2) {
52299
52343
  var _a2;
52300
52344
  const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
@@ -52302,13 +52346,18 @@ function resolveCellStructuralRevision(cell, path, context2) {
52302
52346
  if (revision && matchesRevision(context2, revision.id)) {
52303
52347
  markMatched(context2);
52304
52348
  if (context2.action === "reject" && revision.type === "merge") {
52305
- pushIssue(context2, {
52306
- kind: "cell-merge-original-unavailable",
52307
- revisionId: revision.id,
52308
- path,
52309
- message: "The original cell grid for this merge revision is preserved but not reconstructed by the core resolver yet."
52310
- });
52311
- return cell;
52349
+ const restored = restoreVerticalCellMerge(cell);
52350
+ if (!restored) {
52351
+ pushIssue(context2, {
52352
+ kind: "cell-merge-original-unavailable",
52353
+ revisionId: revision.id,
52354
+ path,
52355
+ message: "The previous merge topology lacks an exact semantic snapshot for safe restoration."
52356
+ });
52357
+ return cell;
52358
+ }
52359
+ markResolved(context2, revision.id);
52360
+ return restored;
52312
52361
  }
52313
52362
  markResolved(context2, revision.id);
52314
52363
  return {
@@ -52324,11 +52373,16 @@ function resolveCellStructuralRevision(cell, path, context2) {
52324
52373
  markResolved(context2, revisionId);
52325
52374
  return { ...cell, mergeRevisionState: void 0 };
52326
52375
  }
52376
+ const restored = restoreVerticalCellMerge(cell);
52377
+ if (restored) {
52378
+ markResolved(context2, revisionId);
52379
+ return restored;
52380
+ }
52327
52381
  pushIssue(context2, {
52328
52382
  kind: "cell-merge-original-unavailable",
52329
52383
  revisionId,
52330
52384
  path: `${path}.mergeRevisionState`,
52331
- message: "The original cell grid is preserved but cannot yet be spliced back into the live table safely."
52385
+ message: "The preserved merge snapshot is not a supported exact vertical-cell restoration."
52332
52386
  });
52333
52387
  }
52334
52388
  return cell;
@@ -52381,6 +52435,30 @@ function transformRow(row, path, context2) {
52381
52435
  if (cellsChanged) next = { ...next, cells };
52382
52436
  return next;
52383
52437
  }
52438
+ function recomputeVerticalMergeRowSpans(table) {
52439
+ let changed = false;
52440
+ const rows = table.rows.map((row, rowIndex) => {
52441
+ let rowChanged = false;
52442
+ const cells = row.cells.map((cell, cellIndex) => {
52443
+ let rowSpan;
52444
+ if (cell.vMerge === "restart") {
52445
+ rowSpan = 1;
52446
+ for (let nextRowIndex = rowIndex + 1; nextRowIndex < table.rows.length; nextRowIndex += 1) {
52447
+ const nextCell = table.rows[nextRowIndex].cells[cellIndex];
52448
+ if (!nextCell || nextCell.vMerge !== "continue") break;
52449
+ rowSpan += 1;
52450
+ }
52451
+ }
52452
+ if (cell.rowSpan === rowSpan) return cell;
52453
+ rowChanged = true;
52454
+ return { ...cell, rowSpan };
52455
+ });
52456
+ if (!rowChanged) return row;
52457
+ changed = true;
52458
+ return { ...row, cells };
52459
+ });
52460
+ return changed ? { ...table, rows } : table;
52461
+ }
52384
52462
  function transformTable(table, path, context2) {
52385
52463
  var _a2;
52386
52464
  let next = table;
@@ -52415,7 +52493,10 @@ function transformTable(table, path, context2) {
52415
52493
  if (transformed !== row) rowsChanged = true;
52416
52494
  }
52417
52495
  if (rowsChanged) next = { ...next, rows };
52418
- if (rowsChanged) recordRemovedParagraphRelocations(table, next, context2);
52496
+ if (rowsChanged) {
52497
+ next = recomputeVerticalMergeRowSpans(next);
52498
+ recordRemovedParagraphRelocations(table, next, context2);
52499
+ }
52419
52500
  return next;
52420
52501
  }
52421
52502
  function transformBlocks(blocks, path, context2) {
@@ -1,4 +1,4 @@
1
- import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-CSKfMgDC.js";
1
+ import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-C0KjmCqU.js";
2
2
  export {
3
3
  dN as ActionRow,
4
4
  ah as BalloonShell,