@underverse-ui/underverse 1.0.192 → 1.0.193

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.
package/dist/index.cjs CHANGED
@@ -1107,6 +1107,19 @@ var en_default = {
1107
1107
  borderStyle: "Border Style",
1108
1108
  borderWidth: "Border Width",
1109
1109
  borderColor: "Border Color",
1110
+ borderPosition: "Border placement",
1111
+ borderMode: "Border mode",
1112
+ borderDraw: "Draw borders",
1113
+ borderErase: "Hide borders",
1114
+ borderAll: "All borders",
1115
+ borderOuter: "Outer borders",
1116
+ borderInner: "Inner borders",
1117
+ borderHorizontal: "Inner horizontal borders",
1118
+ borderVertical: "Inner vertical borders",
1119
+ borderTop: "Top border",
1120
+ borderRight: "Right border",
1121
+ borderBottom: "Bottom border",
1122
+ borderLeft: "Left border",
1110
1123
  clearBorder: "Clear Border",
1111
1124
  formula: "Formula",
1112
1125
  formulaBar: "Formula bar",
@@ -1540,6 +1553,19 @@ var vi_default = {
1540
1553
  borderStyle: "Ki\u1EC3u vi\u1EC1n",
1541
1554
  borderWidth: "\u0110\u1ED9 d\xE0y vi\u1EC1n",
1542
1555
  borderColor: "M\xE0u vi\u1EC1n",
1556
+ borderPosition: "V\u1ECB tr\xED vi\u1EC1n",
1557
+ borderMode: "Ch\u1EBF \u0111\u1ED9 vi\u1EC1n",
1558
+ borderDraw: "V\u1EBD vi\u1EC1n",
1559
+ borderErase: "\u1EA8n c\u1EA1nh",
1560
+ borderAll: "T\u1EA5t c\u1EA3 vi\u1EC1n",
1561
+ borderOuter: "Vi\u1EC1n ngo\xE0i",
1562
+ borderInner: "Vi\u1EC1n trong",
1563
+ borderHorizontal: "Vi\u1EC1n ngang b\xEAn trong",
1564
+ borderVertical: "Vi\u1EC1n d\u1ECDc b\xEAn trong",
1565
+ borderTop: "Vi\u1EC1n tr\xEAn",
1566
+ borderRight: "Vi\u1EC1n ph\u1EA3i",
1567
+ borderBottom: "Vi\u1EC1n d\u01B0\u1EDBi",
1568
+ borderLeft: "Vi\u1EC1n tr\xE1i",
1543
1569
  clearBorder: "X\xF3a vi\u1EC1n",
1544
1570
  formula: "C\xF4ng th\u1EE9c",
1545
1571
  formulaBar: "Thanh c\xF4ng th\u1EE9c",
@@ -1973,6 +1999,19 @@ var ko_default = {
1973
1999
  borderStyle: "\uD14C\uB450\uB9AC \uC2A4\uD0C0\uC77C",
1974
2000
  borderWidth: "\uD14C\uB450\uB9AC \uB450\uAED8",
1975
2001
  borderColor: "\uD14C\uB450\uB9AC \uC0C9\uC0C1",
2002
+ borderPosition: "\uD14C\uB450\uB9AC \uC704\uCE58",
2003
+ borderMode: "\uD14C\uB450\uB9AC \uBAA8\uB4DC",
2004
+ borderDraw: "\uD14C\uB450\uB9AC \uADF8\uB9AC\uAE30",
2005
+ borderErase: "\uD14C\uB450\uB9AC \uC228\uAE30\uAE30",
2006
+ borderAll: "\uBAA8\uB4E0 \uD14C\uB450\uB9AC",
2007
+ borderOuter: "\uBC14\uAE65\uCABD \uD14C\uB450\uB9AC",
2008
+ borderInner: "\uC548\uCABD \uD14C\uB450\uB9AC",
2009
+ borderHorizontal: "\uC548\uCABD \uAC00\uB85C \uD14C\uB450\uB9AC",
2010
+ borderVertical: "\uC548\uCABD \uC138\uB85C \uD14C\uB450\uB9AC",
2011
+ borderTop: "\uC704\uCABD \uD14C\uB450\uB9AC",
2012
+ borderRight: "\uC624\uB978\uCABD \uD14C\uB450\uB9AC",
2013
+ borderBottom: "\uC544\uB798\uCABD \uD14C\uB450\uB9AC",
2014
+ borderLeft: "\uC67C\uCABD \uD14C\uB450\uB9AC",
1976
2015
  clearBorder: "\uD14C\uB450\uB9AC \uC9C0\uC6B0\uAE30",
1977
2016
  formula: "\uC218\uC2DD",
1978
2017
  formulaBar: "\uC218\uC2DD \uC785\uB825\uC904",
@@ -2406,6 +2445,19 @@ var ja_default = {
2406
2445
  borderStyle: "\u67A0\u7DDA\u30B9\u30BF\u30A4\u30EB",
2407
2446
  borderWidth: "\u67A0\u7DDA\u306E\u592A\u3055",
2408
2447
  borderColor: "\u67A0\u7DDA\u306E\u8272",
2448
+ borderPosition: "\u67A0\u7DDA\u306E\u4F4D\u7F6E",
2449
+ borderMode: "\u67A0\u7DDA\u30E2\u30FC\u30C9",
2450
+ borderDraw: "\u67A0\u7DDA\u3092\u5F15\u304F",
2451
+ borderErase: "\u67A0\u7DDA\u3092\u975E\u8868\u793A",
2452
+ borderAll: "\u3059\u3079\u3066\u306E\u67A0\u7DDA",
2453
+ borderOuter: "\u5916\u67A0",
2454
+ borderInner: "\u5185\u5074\u306E\u67A0\u7DDA",
2455
+ borderHorizontal: "\u5185\u5074\u306E\u6A2A\u7F6B\u7DDA",
2456
+ borderVertical: "\u5185\u5074\u306E\u7E26\u7F6B\u7DDA",
2457
+ borderTop: "\u4E0A\u7F6B\u7DDA",
2458
+ borderRight: "\u53F3\u7F6B\u7DDA",
2459
+ borderBottom: "\u4E0B\u7F6B\u7DDA",
2460
+ borderLeft: "\u5DE6\u7F6B\u7DDA",
2409
2461
  clearBorder: "\u67A0\u7DDA\u3092\u30AF\u30EA\u30A2",
2410
2462
  formula: "\u6570\u5F0F",
2411
2463
  formulaBar: "\u6570\u5F0F\u30D0\u30FC",
@@ -31970,7 +32022,7 @@ var CustomTableCell = import_extension_table_cell.default.extend({
31970
32022
  },
31971
32023
  textDirection: {
31972
32024
  default: null,
31973
- parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || element.style.writingMode === "vertical-rl" ? "vertical" : null,
32025
+ parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
31974
32026
  renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
31975
32027
  }
31976
32028
  };
@@ -31989,7 +32041,7 @@ var CustomTableCell = import_extension_table_cell.default.extend({
31989
32041
  if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
31990
32042
  if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
31991
32043
  if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
31992
- if (textDirection === "vertical") mergedStyle += "; writing-mode: vertical-rl; text-orientation: mixed";
32044
+ if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
31993
32045
  mergedStyle = mergedStyle.replace(/^;/, "").trim();
31994
32046
  return [
31995
32047
  "td",
@@ -32096,7 +32148,7 @@ var CustomTableHeader = import_extension_table_header.default.extend({
32096
32148
  },
32097
32149
  textDirection: {
32098
32150
  default: null,
32099
- parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || element.style.writingMode === "vertical-rl" ? "vertical" : null,
32151
+ parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
32100
32152
  renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
32101
32153
  }
32102
32154
  };
@@ -32115,7 +32167,7 @@ var CustomTableHeader = import_extension_table_header.default.extend({
32115
32167
  if (borderStyle) mergedStyle += `; border-style: ${borderStyle}`;
32116
32168
  if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
32117
32169
  if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
32118
- if (textDirection === "vertical") mergedStyle += "; writing-mode: vertical-rl; text-orientation: mixed";
32170
+ if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
32119
32171
  mergedStyle = mergedStyle.replace(/^;/, "").trim();
32120
32172
  return [
32121
32173
  "th",
@@ -34305,13 +34357,141 @@ var EditorToolbar = ({
34305
34357
  // src/components/UEditor/menus.tsx
34306
34358
  var import_react72 = require("react");
34307
34359
  var import_react73 = require("@tiptap/react");
34308
- var import_tables6 = require("@tiptap/pm/tables");
34360
+ var import_tables7 = require("@tiptap/pm/tables");
34309
34361
  var import_react_dom8 = require("react-dom");
34310
34362
  var import_lucide_react54 = require("lucide-react");
34311
34363
 
34364
+ // src/components/UEditor/table-border-commands.ts
34365
+ var import_tables5 = require("@tiptap/pm/tables");
34366
+ var SIDES = ["top", "right", "bottom", "left"];
34367
+ var OPPOSITE_SIDE = {
34368
+ top: "bottom",
34369
+ right: "left",
34370
+ bottom: "top",
34371
+ left: "right"
34372
+ };
34373
+ function splitCssValues(value) {
34374
+ const values = [];
34375
+ let token = "";
34376
+ let parentheses = 0;
34377
+ for (const character of value.trim()) {
34378
+ if (/\s/.test(character) && parentheses === 0) {
34379
+ if (token) values.push(token);
34380
+ token = "";
34381
+ continue;
34382
+ }
34383
+ if (character === "(") parentheses += 1;
34384
+ if (character === ")") parentheses = Math.max(0, parentheses - 1);
34385
+ token += character;
34386
+ }
34387
+ if (token) values.push(token);
34388
+ return values;
34389
+ }
34390
+ function expandCssQuad(value, fallback) {
34391
+ const values = typeof value === "string" ? splitCssValues(value) : [];
34392
+ const [top = fallback, right = top, bottom = top, left = right] = values;
34393
+ return { top, right, bottom, left };
34394
+ }
34395
+ function serializeCssQuad({ top, right, bottom, left }) {
34396
+ if (top === right && top === bottom && top === left) return top;
34397
+ if (top === bottom && right === left) return `${top} ${right}`;
34398
+ if (right === left) return `${top} ${right} ${bottom}`;
34399
+ return `${top} ${right} ${bottom} ${left}`;
34400
+ }
34401
+ function getAppliedSides(position, cell, selection) {
34402
+ const outer = {
34403
+ top: cell.top === selection.top,
34404
+ right: cell.right === selection.right,
34405
+ bottom: cell.bottom === selection.bottom,
34406
+ left: cell.left === selection.left
34407
+ };
34408
+ const inner = {
34409
+ top: cell.top > selection.top,
34410
+ right: cell.right < selection.right,
34411
+ bottom: cell.bottom < selection.bottom,
34412
+ left: cell.left > selection.left
34413
+ };
34414
+ switch (position) {
34415
+ case "all":
34416
+ return { top: true, right: true, bottom: true, left: true };
34417
+ case "outer":
34418
+ return outer;
34419
+ case "inner":
34420
+ return inner;
34421
+ case "horizontal":
34422
+ return { top: inner.top, right: false, bottom: inner.bottom, left: false };
34423
+ case "vertical":
34424
+ return { top: false, right: inner.right, bottom: false, left: inner.left };
34425
+ default:
34426
+ return {
34427
+ top: position === "top" && outer.top,
34428
+ right: position === "right" && outer.right,
34429
+ bottom: position === "bottom" && outer.bottom,
34430
+ left: position === "left" && outer.left
34431
+ };
34432
+ }
34433
+ }
34434
+ function applyTableCellBorders(editor, position, format, options = {}) {
34435
+ const { state, view } = editor;
34436
+ const selection = (0, import_tables5.selectedRect)(state);
34437
+ const transaction = state.tr;
34438
+ const cellPositions = new Set(selection.map.cellsInRect(selection));
34439
+ const sidesByCell = /* @__PURE__ */ new Map();
34440
+ const addSide = (cellPos, side) => {
34441
+ const sides = sidesByCell.get(cellPos) ?? /* @__PURE__ */ new Set();
34442
+ sides.add(side);
34443
+ sidesByCell.set(cellPos, sides);
34444
+ };
34445
+ const addAdjacentSides = (cell, side) => {
34446
+ const adjacentPositions = /* @__PURE__ */ new Set();
34447
+ if (side === "top" && cell.top > 0) {
34448
+ for (let col = cell.left; col < cell.right; col += 1) adjacentPositions.add(selection.map.map[(cell.top - 1) * selection.map.width + col]);
34449
+ } else if (side === "bottom" && cell.bottom < selection.map.height) {
34450
+ for (let col = cell.left; col < cell.right; col += 1) adjacentPositions.add(selection.map.map[cell.bottom * selection.map.width + col]);
34451
+ } else if (side === "left" && cell.left > 0) {
34452
+ for (let row = cell.top; row < cell.bottom; row += 1) adjacentPositions.add(selection.map.map[row * selection.map.width + cell.left - 1]);
34453
+ } else if (side === "right" && cell.right < selection.map.width) {
34454
+ for (let row = cell.top; row < cell.bottom; row += 1) adjacentPositions.add(selection.map.map[row * selection.map.width + cell.right]);
34455
+ }
34456
+ for (const adjacentPos of adjacentPositions) addSide(adjacentPos, OPPOSITE_SIDE[side]);
34457
+ };
34458
+ for (const relativePos of cellPositions) {
34459
+ const cell = selection.map.findCell(relativePos);
34460
+ const appliedSides = getAppliedSides(position, cell, selection);
34461
+ for (const side of SIDES) {
34462
+ if (!appliedSides[side]) continue;
34463
+ addSide(relativePos, side);
34464
+ addAdjacentSides(cell, side);
34465
+ }
34466
+ }
34467
+ for (const [relativePos, appliedSides] of sidesByCell) {
34468
+ const absolutePos = selection.tableStart + relativePos;
34469
+ const node = state.doc.nodeAt(absolutePos);
34470
+ if (!node) continue;
34471
+ const styles = expandCssQuad(node.attrs.borderStyle, "solid");
34472
+ const widths = expandCssQuad(node.attrs.borderWidth, "1px");
34473
+ const colors = expandCssQuad(node.attrs.borderColor, "#000000");
34474
+ for (const side of SIDES) {
34475
+ if (!appliedSides.has(side)) continue;
34476
+ styles[side] = format.style;
34477
+ widths[side] = format.width;
34478
+ colors[side] = format.color || "currentColor";
34479
+ }
34480
+ transaction.setNodeMarkup(absolutePos, void 0, {
34481
+ ...node.attrs,
34482
+ borderStyle: serializeCssQuad(styles),
34483
+ borderWidth: serializeCssQuad(widths),
34484
+ borderColor: serializeCssQuad(colors)
34485
+ });
34486
+ }
34487
+ if (transaction.docChanged) view.dispatch(transaction);
34488
+ if (options.focus ?? true) view.focus();
34489
+ return transaction.docChanged;
34490
+ }
34491
+
34312
34492
  // src/components/UEditor/table-formula-commands.ts
34313
34493
  var import_state11 = require("@tiptap/pm/state");
34314
- var import_tables5 = require("@tiptap/pm/tables");
34494
+ var import_tables6 = require("@tiptap/pm/tables");
34315
34495
 
34316
34496
  // src/components/UEditor/table-formula.ts
34317
34497
  var CELL_ADDRESS_RE = /^([A-Z]+)([1-9]\d*)$/i;
@@ -34902,7 +35082,7 @@ function getSelectionTableCellAnchor(editor) {
34902
35082
  const tableNode = $cell.node(depth);
34903
35083
  if (tableNode.type.name !== "table") continue;
34904
35084
  const tableStart = $cell.start(depth);
34905
- const rect = safeFindCell2(import_tables5.TableMap.get(tableNode), cellPos - tableStart);
35085
+ const rect = safeFindCell2(import_tables6.TableMap.get(tableNode), cellPos - tableStart);
34906
35086
  if (!rect) return null;
34907
35087
  return {
34908
35088
  cellPos,
@@ -34918,7 +35098,7 @@ function getSelectionTableCellAnchor(editor) {
34918
35098
  function restoreSelectionAtTableCell(editor, anchor) {
34919
35099
  const tableNode = editor.state.doc.nodeAt(anchor.tablePos);
34920
35100
  if (!tableNode || tableNode.type.name !== "table") return false;
34921
- const map = import_tables5.TableMap.get(tableNode);
35101
+ const map = import_tables6.TableMap.get(tableNode);
34922
35102
  if (anchor.row >= map.height || anchor.column >= map.width) return false;
34923
35103
  const relativeCellPos = map.positionAt(anchor.row, anchor.column, tableNode);
34924
35104
  const cellPos = anchor.tablePos + 1 + relativeCellPos;
@@ -34974,7 +35154,7 @@ function getSelectionTableCellLabel(editor) {
34974
35154
  const tableNode = $from.node(tableDepth);
34975
35155
  const tableStart = $from.start(tableDepth);
34976
35156
  const relativeCellPos = $from.before(cellDepth) - tableStart;
34977
- const rect = safeFindCell2(import_tables5.TableMap.get(tableNode), relativeCellPos);
35157
+ const rect = safeFindCell2(import_tables6.TableMap.get(tableNode), relativeCellPos);
34978
35158
  if (!rect) return null;
34979
35159
  return `${indexToColumnName(rect.left)}${rect.top + 1}`;
34980
35160
  }
@@ -35012,7 +35192,7 @@ function removeSelectedTableCellFormula(editor, clearContent) {
35012
35192
  return true;
35013
35193
  }
35014
35194
  function buildTableValueMap(tableNode) {
35015
- const map = import_tables5.TableMap.get(tableNode);
35195
+ const map = import_tables6.TableMap.get(tableNode);
35016
35196
  const values = /* @__PURE__ */ new Map();
35017
35197
  for (const rowInfo of getTableRows2(tableNode)) {
35018
35198
  for (const entry of rowInfo.cells) {
@@ -35037,8 +35217,8 @@ function setSelectedTableCellFormula(editor, formula) {
35037
35217
  if (!normalized) {
35038
35218
  return clearSelectedTableCellFormula(editor);
35039
35219
  }
35040
- const appliedFormula = (0, import_tables5.setCellAttr)("formula", normalized)(state, view.dispatch.bind(view));
35041
- const clearedValue = (0, import_tables5.setCellAttr)("computedValue", null)(editor.state, view.dispatch.bind(view));
35220
+ const appliedFormula = (0, import_tables6.setCellAttr)("formula", normalized)(state, view.dispatch.bind(view));
35221
+ const clearedValue = (0, import_tables6.setCellAttr)("computedValue", null)(editor.state, view.dispatch.bind(view));
35042
35222
  if (appliedFormula || clearedValue) {
35043
35223
  recalculateActiveTableFormulas(editor);
35044
35224
  if (selectionAnchor) restoreSelectionAtTableCell(editor, selectionAnchor);
@@ -35057,7 +35237,7 @@ function convertSelectedTableCellFormulaToValue(editor) {
35057
35237
  function setSelectedTableCellNumberFormat(editor, numberFormat) {
35058
35238
  const value = numberFormat && numberFormat !== "text" ? numberFormat : null;
35059
35239
  const { state, view } = editor;
35060
- const applied = (0, import_tables5.setCellAttr)("numberFormat", value)(state, view.dispatch.bind(view));
35240
+ const applied = (0, import_tables6.setCellAttr)("numberFormat", value)(state, view.dispatch.bind(view));
35061
35241
  if (!applied) return false;
35062
35242
  recalculateSelectedTable(editor);
35063
35243
  view.focus();
@@ -35129,7 +35309,7 @@ function promoteFormulaTextInTableNode(tableNode) {
35129
35309
  function recalculateTableNode(tableNode, options) {
35130
35310
  const promoted = promoteFormulaTextInTableNode(tableNode);
35131
35311
  tableNode = promoted.tableNode;
35132
- const map = import_tables5.TableMap.get(tableNode);
35312
+ const map = import_tables6.TableMap.get(tableNode);
35133
35313
  const values = buildTableValueMap(tableNode);
35134
35314
  const formulaEntries = /* @__PURE__ */ new Map();
35135
35315
  let changed = false;
@@ -35200,7 +35380,7 @@ function recalculateTableNode(tableNode, options) {
35200
35380
  return tableNode.type.create(tableNode.attrs, rows);
35201
35381
  }
35202
35382
  function recalculateSelectedTable(editor) {
35203
- const rect = (0, import_tables5.selectedRect)(editor.state);
35383
+ const rect = (0, import_tables6.selectedRect)(editor.state);
35204
35384
  const tableNode = rect.table;
35205
35385
  const nextTable = recalculateTableNode(tableNode);
35206
35386
  if (!nextTable) return false;
@@ -35307,7 +35487,7 @@ var FloatingMenuContent = ({ editor }) => {
35307
35487
  function applyTableCellBackground(editor, color) {
35308
35488
  const value = color || null;
35309
35489
  const { state, view } = editor;
35310
- const applied = (0, import_tables6.setCellAttr)("backgroundColor", value)(state, view.dispatch.bind(view));
35490
+ const applied = (0, import_tables7.setCellAttr)("backgroundColor", value)(state, view.dispatch.bind(view));
35311
35491
  if (applied) {
35312
35492
  view.focus();
35313
35493
  return;
@@ -35317,7 +35497,7 @@ function applyTableCellBackground(editor, color) {
35317
35497
  function applyTableCellAttribute2(editor, name, value, options = {}) {
35318
35498
  const shouldFocus = options.focus ?? true;
35319
35499
  const { state, view } = editor;
35320
- const applied = (0, import_tables6.setCellAttr)(name, value)(state, view.dispatch.bind(view));
35500
+ const applied = (0, import_tables7.setCellAttr)(name, value)(state, view.dispatch.bind(view));
35321
35501
  if (applied) {
35322
35502
  if (shouldFocus) view.focus();
35323
35503
  return;
@@ -35344,6 +35524,32 @@ function BorderStylePreviewIcon({ style }) {
35344
35524
  }
35345
35525
  );
35346
35526
  }
35527
+ function BorderPositionPreviewIcon({ position }) {
35528
+ const showTop = position === "all" || position === "outer" || position === "top";
35529
+ const showRight = position === "all" || position === "outer" || position === "right";
35530
+ const showBottom = position === "all" || position === "outer" || position === "bottom";
35531
+ const showLeft = position === "all" || position === "outer" || position === "left";
35532
+ const showHorizontal = position === "all" || position === "inner" || position === "horizontal";
35533
+ const showVertical = position === "all" || position === "inner" || position === "vertical";
35534
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-5 w-5 fill-none stroke-current", children: [
35535
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35536
+ "path",
35537
+ {
35538
+ d: "M2 2H18V18H2Z M2 10H18 M10 2V18",
35539
+ className: "text-foreground opacity-70",
35540
+ stroke: "currentColor",
35541
+ strokeDasharray: "2 1.5",
35542
+ strokeWidth: "1.25"
35543
+ }
35544
+ ),
35545
+ showTop && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 2H18", strokeWidth: "2" }),
35546
+ showRight && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M18 2V18", strokeWidth: "2" }),
35547
+ showBottom && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 18H18", strokeWidth: "2" }),
35548
+ showLeft && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 2V18", strokeWidth: "2" }),
35549
+ showHorizontal && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M2 10H18", strokeWidth: "2" }),
35550
+ showVertical && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("path", { d: "M10 2V18", strokeWidth: "2" })
35551
+ ] });
35552
+ }
35347
35553
  var BubbleMenuContent = ({
35348
35554
  editor,
35349
35555
  onKeepOpenChange,
@@ -35351,7 +35557,8 @@ var BubbleMenuContent = ({
35351
35557
  onRequestClose,
35352
35558
  fontSizes,
35353
35559
  lineHeights,
35354
- initialShowLinkInput = false
35560
+ initialShowLinkInput = false,
35561
+ cellBorderOpenRequest = 0
35355
35562
  }) => {
35356
35563
  const t = useSmartTranslations("UEditor");
35357
35564
  (0, import_react73.useEditorState)({
@@ -35364,6 +35571,11 @@ var BubbleMenuContent = ({
35364
35571
  (0, import_react72.useEffect)(() => {
35365
35572
  setShowLinkInput(initialShowLinkInput);
35366
35573
  }, [initialShowLinkInput]);
35574
+ (0, import_react72.useEffect)(() => {
35575
+ if (!cellBorderOpenRequest) return;
35576
+ setActiveColorPalette("cell-border");
35577
+ onKeepOpenChange?.(true);
35578
+ }, [cellBorderOpenRequest, onKeepOpenChange]);
35367
35579
  const [showTypographyPanel, setShowTypographyPanel] = (0, import_react72.useState)(false);
35368
35580
  const [showFormulaPanel, setShowFormulaPanel] = (0, import_react72.useState)(false);
35369
35581
  const [formulaDraft, setFormulaDraft] = (0, import_react72.useState)("");
@@ -35381,9 +35593,17 @@ var BubbleMenuContent = ({
35381
35593
  const currentCellNumberFormat = normalizeStyleValue(editor.getAttributes("tableCell").numberFormat || editor.getAttributes("tableHeader").numberFormat) || "text";
35382
35594
  const currentCellBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
35383
35595
  const currentCellBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
35596
+ const currentCellBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "#000000";
35597
+ const [borderStyleDraft, setBorderStyleDraft] = (0, import_react72.useState)(
35598
+ ["solid", "dashed", "dotted", "double"].includes(currentCellBorderStyle) ? currentCellBorderStyle : "solid"
35599
+ );
35600
+ const [borderWidthDraft, setBorderWidthDraft] = (0, import_react72.useState)(currentCellBorderWidth);
35601
+ const [borderColorDraft, setBorderColorDraft] = (0, import_react72.useState)(currentCellBorderColor);
35602
+ const [borderEditMode, setBorderEditMode] = (0, import_react72.useState)("draw");
35603
+ const [activeBorderPosition, setActiveBorderPosition] = (0, import_react72.useState)("all");
35384
35604
  const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
35385
35605
  const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
35386
- const isInTable2 = (0, import_tables6.isInTable)(editor.state);
35606
+ const isInTable2 = (0, import_tables7.isInTable)(editor.state);
35387
35607
  const canMergeCells = isInTable2 && editor.can().mergeCells();
35388
35608
  const canSplitCell = isInTable2 && editor.can().splitCell();
35389
35609
  const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
@@ -35437,21 +35657,60 @@ var BubbleMenuContent = ({
35437
35657
  onLinkInputOpenChange?.(false);
35438
35658
  onRequestClose?.();
35439
35659
  }, [onKeepOpenChange, onLinkInputOpenChange, onRequestClose]);
35440
- const applyTableCellAttributeAndClose = (0, import_react72.useCallback)((name, value) => {
35441
- applyTableCellAttribute2(editor, name, value, { focus: false });
35442
- closeTransientPanels();
35443
- }, [closeTransientPanels, editor]);
35444
- const clearTableCellBorderAndClose = (0, import_react72.useCallback)(() => {
35445
- applyTableCellAttribute2(editor, "borderColor", null, { focus: false });
35446
- applyTableCellAttribute2(editor, "borderStyle", null, { focus: false });
35447
- applyTableCellAttribute2(editor, "borderWidth", null, { focus: false });
35448
- closeTransientPanels();
35449
- }, [closeTransientPanels, editor]);
35450
- const applyTableCellBorderColorAndClose = (0, import_react72.useCallback)((color) => {
35451
- const value = color || null;
35452
- applyTableCellAttribute2(editor, "borderColor", value, { focus: false });
35453
- closeTransientPanels();
35454
- }, [closeTransientPanels, editor]);
35660
+ const selectTableCellBorderColor = (0, import_react72.useCallback)((color) => {
35661
+ const value = color || "currentColor";
35662
+ setBorderColorDraft(value);
35663
+ setBorderEditMode("draw");
35664
+ setActiveBorderPosition("all");
35665
+ applyTableCellBorders(editor, "all", {
35666
+ color: value,
35667
+ style: borderStyleDraft,
35668
+ width: borderWidthDraft
35669
+ }, { focus: false });
35670
+ setActiveColorPalette("cell-border");
35671
+ onKeepOpenChange?.(true);
35672
+ }, [borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
35673
+ const applyTableCellBorderPosition = (0, import_react72.useCallback)((position) => {
35674
+ setActiveBorderPosition(position);
35675
+ applyTableCellBorders(editor, position, {
35676
+ color: borderColorDraft,
35677
+ style: borderEditMode === "erase" ? "none" : borderStyleDraft,
35678
+ width: borderWidthDraft
35679
+ }, { focus: false });
35680
+ onKeepOpenChange?.(true);
35681
+ }, [borderColorDraft, borderEditMode, borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
35682
+ const applyTableCellBorderStyle = (0, import_react72.useCallback)((style) => {
35683
+ setBorderStyleDraft(style);
35684
+ setBorderEditMode("draw");
35685
+ setActiveBorderPosition("all");
35686
+ applyTableCellBorders(editor, "all", {
35687
+ color: borderColorDraft,
35688
+ style,
35689
+ width: borderWidthDraft
35690
+ }, { focus: false });
35691
+ onKeepOpenChange?.(true);
35692
+ }, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
35693
+ const applyTableCellBorderWidth = (0, import_react72.useCallback)((width) => {
35694
+ setBorderWidthDraft(width);
35695
+ setBorderEditMode("draw");
35696
+ setActiveBorderPosition("all");
35697
+ applyTableCellBorders(editor, "all", {
35698
+ color: borderColorDraft,
35699
+ style: borderStyleDraft,
35700
+ width
35701
+ }, { focus: false });
35702
+ onKeepOpenChange?.(true);
35703
+ }, [borderColorDraft, borderStyleDraft, editor, onKeepOpenChange]);
35704
+ const clearTableCellBorders = (0, import_react72.useCallback)(() => {
35705
+ setActiveBorderPosition("all");
35706
+ setBorderEditMode("erase");
35707
+ applyTableCellBorders(editor, "all", {
35708
+ color: borderColorDraft,
35709
+ style: "none",
35710
+ width: borderWidthDraft
35711
+ }, { focus: false });
35712
+ onKeepOpenChange?.(true);
35713
+ }, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
35455
35714
  const closeColorPalette = (0, import_react72.useCallback)(() => {
35456
35715
  setActiveColorPalette(null);
35457
35716
  onKeepOpenChange?.(false);
@@ -35505,27 +35764,104 @@ var BubbleMenuContent = ({
35505
35764
  const isTextPalette = activeColorPalette === "text";
35506
35765
  const isHighlightPalette = activeColorPalette === "highlight";
35507
35766
  if (activeColorPalette === "cell-border") {
35508
- const currentBorderColor = editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || "currentColor";
35509
- return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-2 p-2 w-56 text-sm", "data-ueditor-keep-open": true, children: [
35767
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex w-72 flex-col gap-2 p-2 text-sm", "data-ueditor-keep-open": true, children: [
35510
35768
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
35769
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex gap-2", children: [
35770
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "min-w-0 flex-1", children: [
35771
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("label", { className: "mb-1 block text-xs text-muted-foreground", children: t("tableMenu.borderPosition") || "Border placement" }),
35772
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "grid grid-cols-5 gap-1", role: "group", "aria-label": t("tableMenu.borderPosition") || "Border placement", children: [
35773
+ [
35774
+ ["all", "borderAll"],
35775
+ ["outer", "borderOuter"],
35776
+ ["inner", "borderInner"],
35777
+ ["horizontal", "borderHorizontal"],
35778
+ ["vertical", "borderVertical"],
35779
+ ["top", "borderTop"],
35780
+ ["right", "borderRight"],
35781
+ ["bottom", "borderBottom"],
35782
+ ["left", "borderLeft"]
35783
+ ].map(([position, labelKey]) => {
35784
+ const label = t(`tableMenu.${labelKey}`) || position;
35785
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35786
+ "button",
35787
+ {
35788
+ type: "button",
35789
+ "aria-label": label,
35790
+ title: label,
35791
+ onMouseDown: (event) => event.preventDefault(),
35792
+ onClick: () => applyTableCellBorderPosition(position),
35793
+ className: cn(
35794
+ "inline-flex h-8 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted hover:text-primary",
35795
+ activeBorderPosition === position ? "bg-primary/10 text-primary" : "bg-muted/40"
35796
+ ),
35797
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(BorderPositionPreviewIcon, { position })
35798
+ },
35799
+ position
35800
+ );
35801
+ }),
35802
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35803
+ "button",
35804
+ {
35805
+ type: "button",
35806
+ "aria-label": t("tableMenu.clearBorder") || "Clear borders",
35807
+ title: t("tableMenu.clearBorder") || "Clear borders",
35808
+ onMouseDown: (event) => event.preventDefault(),
35809
+ onClick: clearTableCellBorders,
35810
+ className: "inline-flex h-8 items-center justify-center rounded-md bg-muted/40 text-destructive transition-colors hover:bg-destructive/10",
35811
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(BorderStylePreviewIcon, { style: "none" })
35812
+ }
35813
+ )
35814
+ ] })
35815
+ ] }),
35816
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-1 border-l border-border pl-2 pt-5", role: "group", "aria-label": t("tableMenu.borderMode") || "Border mode", children: [
35817
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35818
+ "button",
35819
+ {
35820
+ type: "button",
35821
+ "aria-label": t("tableMenu.borderDraw") || "Draw borders",
35822
+ title: t("tableMenu.borderDraw") || "Draw borders",
35823
+ onMouseDown: (event) => event.preventDefault(),
35824
+ onClick: () => setBorderEditMode("draw"),
35825
+ className: cn(
35826
+ "inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
35827
+ borderEditMode === "draw" ? "bg-primary/10 text-primary" : "text-muted-foreground"
35828
+ ),
35829
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react54.Edit2, { className: "h-4 w-4" })
35830
+ }
35831
+ ),
35832
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35833
+ "button",
35834
+ {
35835
+ type: "button",
35836
+ "aria-label": t("tableMenu.borderErase") || "Hide borders",
35837
+ title: t("tableMenu.borderErase") || "Hide borders",
35838
+ onMouseDown: (event) => event.preventDefault(),
35839
+ onClick: () => setBorderEditMode("erase"),
35840
+ className: cn(
35841
+ "inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
35842
+ borderEditMode === "erase" ? "bg-destructive/10 text-destructive" : "text-muted-foreground"
35843
+ ),
35844
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react54.Eraser, { className: "h-4 w-4" })
35845
+ }
35846
+ )
35847
+ ] })
35848
+ ] }),
35511
35849
  /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-1", children: [
35512
35850
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
35513
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid grid-cols-3 gap-1", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
35851
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid grid-cols-4 gap-1.5", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
35514
35852
  ["solid", "Solid"],
35515
35853
  ["dashed", "Dashed"],
35516
35854
  ["dotted", "Dotted"],
35517
- ["double", "Double"],
35518
- ["none", "None"]
35855
+ ["double", "Double"]
35519
35856
  ].map(([style, label]) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
35520
35857
  "button",
35521
35858
  {
35522
35859
  type: "button",
35523
- "data-ueditor-close-on-select": true,
35524
35860
  onMouseDown: (event) => event.preventDefault(),
35525
- onClick: () => applyTableCellAttributeAndClose("borderStyle", style),
35861
+ onClick: () => applyTableCellBorderStyle(style),
35526
35862
  className: cn(
35527
- "inline-flex h-8 items-center justify-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors hover:bg-muted",
35528
- currentCellBorderStyle === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
35863
+ "inline-flex h-8 min-w-0 items-center justify-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors hover:bg-muted",
35864
+ borderStyleDraft === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
35529
35865
  ),
35530
35866
  children: [
35531
35867
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(BorderStylePreviewIcon, { style }),
@@ -35541,12 +35877,11 @@ var BubbleMenuContent = ({
35541
35877
  "button",
35542
35878
  {
35543
35879
  type: "button",
35544
- "data-ueditor-close-on-select": true,
35545
35880
  onMouseDown: (event) => event.preventDefault(),
35546
- onClick: () => applyTableCellAttributeAndClose("borderWidth", width),
35881
+ onClick: () => applyTableCellBorderWidth(width),
35547
35882
  className: cn(
35548
35883
  "h-8 rounded-md px-2 text-xs font-medium transition-colors hover:bg-muted",
35549
- currentCellBorderWidth === width ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
35884
+ borderWidthDraft === width ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
35550
35885
  ),
35551
35886
  children: width
35552
35887
  },
@@ -35566,33 +35901,22 @@ var BubbleMenuContent = ({
35566
35901
  {
35567
35902
  className: "w-4 h-4 rounded-full border border-border",
35568
35903
  style: {
35569
- backgroundColor: currentBorderColor
35904
+ backgroundColor: borderColorDraft
35570
35905
  }
35571
35906
  }
35572
35907
  )
35573
35908
  ]
35574
35909
  }
35575
- ),
35576
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "flex items-center justify-between gap-2 mt-2 pt-2 border-t border-border", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35577
- "button",
35578
- {
35579
- type: "button",
35580
- "data-ueditor-close-on-select": true,
35581
- onClick: clearTableCellBorderAndClose,
35582
- className: "text-xs text-destructive hover:underline",
35583
- children: t("tableMenu.clearBorder") || "Clear Border"
35584
- }
35585
- ) })
35910
+ )
35586
35911
  ] });
35587
35912
  }
35588
35913
  if (activeColorPalette === "cell-border-color") {
35589
- const currentBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "";
35590
35914
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
35591
35915
  EditorColorPalette,
35592
35916
  {
35593
35917
  colors: borderColors,
35594
- currentColor: currentBorderColor,
35595
- onSelect: applyTableCellBorderColorAndClose,
35918
+ currentColor: borderColorDraft,
35919
+ onSelect: selectTableCellBorderColor,
35596
35920
  label: t("tableMenu.borderColor") || "Border Color"
35597
35921
  }
35598
35922
  ) });
@@ -36110,6 +36434,7 @@ var CustomBubbleMenu = ({
36110
36434
  const BUBBLE_MENU_ESTIMATED_HEIGHT = 44;
36111
36435
  const [isVisible, setIsVisible] = (0, import_react72.useState)(false);
36112
36436
  const [linkInputOpen, setLinkInputOpen] = (0, import_react72.useState)(false);
36437
+ const [cellBorderOpenRequest, setCellBorderOpenRequest] = (0, import_react72.useState)(0);
36113
36438
  const [position, setPosition2] = (0, import_react72.useState)({
36114
36439
  top: 0,
36115
36440
  left: 0,
@@ -36126,8 +36451,8 @@ var CustomBubbleMenu = ({
36126
36451
  if (!next) setLinkInputOpen(false);
36127
36452
  if (next) setIsVisible(true);
36128
36453
  }, []);
36129
- const closeBubbleMenu = (0, import_react72.useCallback)(() => {
36130
- suppressShowUntilRef.current = Date.now() + 1e3;
36454
+ const closeBubbleMenu = (0, import_react72.useCallback)((suppressShow = true) => {
36455
+ suppressShowUntilRef.current = suppressShow ? Date.now() + 1e3 : 0;
36131
36456
  keepOpenRef.current = false;
36132
36457
  setKeepOpenState(false);
36133
36458
  setLinkInputOpen(false);
@@ -36219,6 +36544,41 @@ var CustomBubbleMenu = ({
36219
36544
  editor.off("update", updatePosition);
36220
36545
  };
36221
36546
  }, [editor]);
36547
+ (0, import_react72.useEffect)(() => {
36548
+ if (!isVisible) return;
36549
+ const handlePointerDown = (event) => {
36550
+ const target = event.target;
36551
+ if (target && (menuRef.current?.contains(target) || target.closest("[data-ueditor-keep-open]"))) return;
36552
+ const table = target?.closest("table");
36553
+ if (table && editor.view.dom.contains(table)) return;
36554
+ closeBubbleMenu(false);
36555
+ };
36556
+ const handleKeyDown2 = (event) => {
36557
+ if (event.key === "Escape") closeBubbleMenu();
36558
+ };
36559
+ document.addEventListener("pointerdown", handlePointerDown, true);
36560
+ document.addEventListener("keydown", handleKeyDown2);
36561
+ return () => {
36562
+ document.removeEventListener("pointerdown", handlePointerDown, true);
36563
+ document.removeEventListener("keydown", handleKeyDown2);
36564
+ };
36565
+ }, [closeBubbleMenu, editor, isVisible]);
36566
+ (0, import_react72.useEffect)(() => {
36567
+ const handleTableDoubleClick = (event) => {
36568
+ const target = event.target;
36569
+ const cell = target?.closest("td,th");
36570
+ if (!cell || !editor.view.dom.contains(cell)) return;
36571
+ suppressShowUntilRef.current = 0;
36572
+ keepOpenRef.current = true;
36573
+ setKeepOpenState(true);
36574
+ setLinkInputOpen(false);
36575
+ setCellBorderOpenRequest((request) => request + 1);
36576
+ setIsVisible(true);
36577
+ requestAnimationFrame(() => editor.view.focus());
36578
+ };
36579
+ editor.view.dom.addEventListener("dblclick", handleTableDoubleClick);
36580
+ return () => editor.view.dom.removeEventListener("dblclick", handleTableDoubleClick);
36581
+ }, [editor]);
36222
36582
  if (!isVisible) return null;
36223
36583
  return (0, import_react_dom8.createPortal)(
36224
36584
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
@@ -36259,7 +36619,8 @@ var CustomBubbleMenu = ({
36259
36619
  onRequestClose: closeBubbleMenu,
36260
36620
  fontSizes,
36261
36621
  lineHeights,
36262
- initialShowLinkInput: linkInputOpen
36622
+ initialShowLinkInput: linkInputOpen,
36623
+ cellBorderOpenRequest
36263
36624
  }
36264
36625
  )
36265
36626
  }
@@ -40711,7 +41072,7 @@ function moveTableRow$1(table, indexesOrigin, indexesTarget, direction) {
40711
41072
  rows = moveRowInArrayOfRows(rows, indexesOrigin, indexesTarget, direction);
40712
41073
  return convertArrayOfRowsToTableNode(table, rows);
40713
41074
  }
40714
- function selectedRect3(state) {
41075
+ function selectedRect4(state) {
40715
41076
  const sel = state.selection;
40716
41077
  const $pos = selectionCell(state);
40717
41078
  const table = $pos.node(-1);
@@ -40729,7 +41090,7 @@ function deprecated_toggleHeader(type) {
40729
41090
  if (!isInTable(state)) return false;
40730
41091
  if (dispatch) {
40731
41092
  const types = tableNodeTypes2(state.schema);
40732
- const rect = selectedRect3(state), tr = state.tr;
41093
+ const rect = selectedRect4(state), tr = state.tr;
40733
41094
  const cells = rect.map.cellsInRect(type == "column" ? {
40734
41095
  left: rect.left,
40735
41096
  top: 0,
@@ -40769,7 +41130,7 @@ function toggleHeader(type, options) {
40769
41130
  if (!isInTable(state)) return false;
40770
41131
  if (dispatch) {
40771
41132
  const types = tableNodeTypes2(state.schema);
40772
- const rect = selectedRect3(state), tr = state.tr;
41133
+ const rect = selectedRect4(state), tr = state.tr;
40773
41134
  const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types);
40774
41135
  const isHeaderColumnEnabled = isHeaderEnabledByType("column", rect, types);
40775
41136
  const selectionStartsAt = (type === "column" ? isHeaderRowEnabled : type === "row" ? isHeaderColumnEnabled : false) ? 1 : 0;
@@ -42789,11 +43150,11 @@ function useUEditorTableInteractions(editor, editable = true) {
42789
43150
 
42790
43151
  // src/components/UEditor/use-formula-coordinate-overlay.ts
42791
43152
  var import_react77 = require("react");
42792
- var import_tables8 = require("@tiptap/pm/tables");
43153
+ var import_tables9 = require("@tiptap/pm/tables");
42793
43154
 
42794
43155
  // src/components/UEditor/table-formula-range-picker.ts
42795
43156
  var import_state12 = require("@tiptap/pm/state");
42796
- var import_tables7 = require("@tiptap/pm/tables");
43157
+ var import_tables8 = require("@tiptap/pm/tables");
42797
43158
  function getCellText2(cellNode) {
42798
43159
  return cellNode.textBetween(0, cellNode.content.size, "\n").trim();
42799
43160
  }
@@ -42811,7 +43172,7 @@ function getFormulaEditingTableContext(view) {
42811
43172
  if (!tableNode || tableNode.type.name !== "table") return null;
42812
43173
  const tableDom = cellDom.closest("table");
42813
43174
  if (!(tableDom instanceof HTMLTableElement)) return null;
42814
- const tableMap = import_tables7.TableMap.get(tableNode);
43175
+ const tableMap = import_tables8.TableMap.get(tableNode);
42815
43176
  const tableStart = $from.start(tableDepth);
42816
43177
  const formulaCellRect = tableMap.findCell(cellPos - tableStart);
42817
43178
  return {
@@ -42828,7 +43189,7 @@ function getFormulaEditingTableContext(view) {
42828
43189
  return null;
42829
43190
  }
42830
43191
  function collectTableFormulaCells(tableNode) {
42831
- const tableMap = import_tables7.TableMap.get(tableNode);
43192
+ const tableMap = import_tables8.TableMap.get(tableNode);
42832
43193
  const formulas = [];
42833
43194
  tableNode.forEach((rowNode, rowOffset) => {
42834
43195
  rowNode.forEach((cellNode, cellOffset) => {
@@ -42914,7 +43275,7 @@ function getFormulaTableCellInfo(view, target, tablePos) {
42914
43275
  const domPos = view.posAtDOM(cell, 0);
42915
43276
  const tableInfo = findTableForPos(view, domPos);
42916
43277
  if (!tableInfo || tableInfo.pos !== tablePos) return null;
42917
- const map = import_tables7.TableMap.get(tableInfo.node);
43278
+ const map = import_tables8.TableMap.get(tableInfo.node);
42918
43279
  const relativeCellPos = getCellRelativePosFromDomPos2(map, tableInfo.start, domPos);
42919
43280
  if (relativeCellPos == null) return null;
42920
43281
  const rect = map.findCell(relativeCellPos);
@@ -43088,7 +43449,7 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
43088
43449
  const tableRect = context.tableDom.getBoundingClientRect();
43089
43450
  const tableLeft = tableRect.left - containerRect.left + container.scrollLeft;
43090
43451
  const tableTop = tableRect.top - containerRect.top + container.scrollTop;
43091
- const map = import_tables8.TableMap.get(context.tableNode);
43452
+ const map = import_tables9.TableMap.get(context.tableNode);
43092
43453
  const columnSegments = Array(map.width);
43093
43454
  const rowSegments = Array(map.height);
43094
43455
  const cellInfos = [];