@underverse-ui/underverse 1.0.205 → 1.0.206

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
@@ -498,7 +498,9 @@ var init_en = __esm({
498
498
  alignVerticalBottom: "Bottom Align",
499
499
  textDirection: "Text Direction",
500
500
  horizontalText: "Horizontal Text",
501
- verticalText: "Vertical Text"
501
+ verticalText: "Vertical Text",
502
+ wrapText: "Wrap Text",
503
+ noWrapText: "Don't Wrap Text"
502
504
  },
503
505
  callout: {
504
506
  selectEmoji: "Select Emoji",
@@ -954,7 +956,9 @@ var init_vi = __esm({
954
956
  alignVerticalBottom: "C\u0103n d\u01B0\u1EDBi",
955
957
  textDirection: "H\u01B0\u1EDBng ch\u1EEF",
956
958
  horizontalText: "Ch\u1EEF ngang",
957
- verticalText: "Ch\u1EEF d\u1ECDc"
959
+ verticalText: "Ch\u1EEF d\u1ECDc",
960
+ wrapText: "T\u1EF1 xu\u1ED1ng d\xF2ng",
961
+ noWrapText: "Kh\xF4ng xu\u1ED1ng d\xF2ng"
958
962
  },
959
963
  callout: {
960
964
  selectEmoji: "Ch\u1ECDn Bi\u1EC3u t\u01B0\u1EE3ng",
@@ -1410,7 +1414,9 @@ var init_ko = __esm({
1410
1414
  alignVerticalBottom: "\uC544\uB798\uCABD \uB9DE\uCDA4",
1411
1415
  textDirection: "\uD14D\uC2A4\uD2B8 \uBC29\uD5A5",
1412
1416
  horizontalText: "\uAC00\uB85C\uC4F0\uAE30",
1413
- verticalText: "\uC138\uB85C\uC4F0\uAE30"
1417
+ verticalText: "\uC138\uB85C\uC4F0\uAE30",
1418
+ wrapText: "\uD14D\uC2A4\uD2B8 \uC904 \uBC14\uAFC8",
1419
+ noWrapText: "\uC904 \uBC14\uAFC8 \uC548 \uD568"
1414
1420
  },
1415
1421
  callout: {
1416
1422
  selectEmoji: "\uC774\uBAA8\uC9C0 \uC120\uD0DD",
@@ -1866,7 +1872,9 @@ var init_ja = __esm({
1866
1872
  alignVerticalBottom: "\u4E0B\u63C3\u3048",
1867
1873
  textDirection: "\u6587\u5B57\u65B9\u5411",
1868
1874
  horizontalText: "\u6A2A\u66F8\u304D",
1869
- verticalText: "\u7E26\u66F8\u304D"
1875
+ verticalText: "\u7E26\u66F8\u304D",
1876
+ wrapText: "\u30C6\u30AD\u30B9\u30C8\u3092\u6298\u308A\u8FD4\u3059",
1877
+ noWrapText: "\u6298\u308A\u8FD4\u3055\u306A\u3044"
1870
1878
  },
1871
1879
  callout: {
1872
1880
  selectEmoji: "\u7D75\u6587\u5B57\u3092\u9078\u629E",
@@ -5919,16 +5927,19 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
5919
5927
  const tableDom = editor.view.nodeDOM(tableInfo.pos);
5920
5928
  const tableElement = domAtTableElement?.closest?.("table") ?? (tableDom instanceof HTMLTableElement ? tableDom : tableDom instanceof HTMLElement ? tableDom.querySelector("table") : null) ?? (editor.view.dom.querySelectorAll("table").length === 1 ? editor.view.dom.querySelector("table") : null);
5921
5929
  if (tableElement instanceof HTMLTableElement) {
5930
+ tableElement.style.tableLayout = "fixed";
5931
+ if (tableElement.style.width === "max-content") {
5932
+ tableElement.style.removeProperty("width");
5933
+ }
5934
+ if (tableElement.style.maxWidth === "100%") {
5935
+ tableElement.style.removeProperty("max-width");
5936
+ }
5922
5937
  if (tableAlign) {
5923
5938
  tableElement.setAttribute("data-table-align", tableAlign);
5924
- tableElement.style.width = "max-content";
5925
- tableElement.style.maxWidth = "100%";
5926
5939
  tableElement.style.marginLeft = tableAlign === "center" || tableAlign === "right" ? "auto" : "0";
5927
5940
  tableElement.style.marginRight = tableAlign === "center" ? "auto" : tableAlign === "right" ? "0" : "auto";
5928
5941
  } else {
5929
5942
  tableElement.removeAttribute("data-table-align");
5930
- tableElement.style.removeProperty("width");
5931
- tableElement.style.removeProperty("max-width");
5932
5943
  tableElement.style.removeProperty("margin-left");
5933
5944
  tableElement.style.removeProperty("margin-right");
5934
5945
  }
@@ -7074,6 +7085,7 @@ function computeEditorUiRenderState(editor) {
7074
7085
  formula: tableCell.formula ?? tableHeader.formula ?? null,
7075
7086
  numberFormat: tableCell.numberFormat ?? tableHeader.numberFormat ?? null,
7076
7087
  textDirection: tableCell.textDirection ?? tableHeader.textDirection ?? null,
7088
+ textWrap: tableCell.textWrap ?? tableHeader.textWrap ?? "wrap",
7077
7089
  verticalAlign: tableCell.verticalAlign ?? tableHeader.verticalAlign ?? null
7078
7090
  },
7079
7091
  can: {
@@ -7285,6 +7297,7 @@ var init_toolbar = __esm({
7285
7297
  const canSplitCell = hasTableContext && editor.can().splitCell();
7286
7298
  const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
7287
7299
  const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
7300
+ const currentCellTextWrap = normalizeStyleValue(editor.getAttributes("tableCell").textWrap || editor.getAttributes("tableHeader").textWrap) || "wrap";
7288
7301
  const currentFontFamily = normalizeStyleValue(textStyleAttrs.fontFamily);
7289
7302
  const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
7290
7303
  const currentTextColor = normalizeStyleValue(textStyleAttrs.color) || "inherit";
@@ -7795,33 +7808,44 @@ var init_toolbar = __esm({
7795
7808
  ]
7796
7809
  }
7797
7810
  ),
7798
- hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
7799
- DropdownMenu,
7800
- {
7801
- trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
7802
- }, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" }) }),
7803
- children: [
7804
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7805
- DropdownMenuItem,
7806
- {
7807
- icon: import_lucide_react52.ArrowRight,
7808
- label: t("tableMenu.horizontalText"),
7809
- onClick: () => applyTableCellAttribute(editor, "textDirection", null),
7810
- active: currentCellTextDirection === "horizontal"
7811
- }
7812
- ),
7813
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7814
- DropdownMenuItem,
7815
- {
7816
- icon: import_lucide_react52.ArrowDown,
7817
- label: t("tableMenu.verticalText"),
7818
- onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
7819
- active: currentCellTextDirection === "vertical"
7820
- }
7821
- )
7822
- ]
7823
- }
7824
- )
7811
+ hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
7812
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
7813
+ DropdownMenu,
7814
+ {
7815
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
7816
+ }, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" }) }),
7817
+ children: [
7818
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7819
+ DropdownMenuItem,
7820
+ {
7821
+ icon: import_lucide_react52.ArrowRight,
7822
+ label: t("tableMenu.horizontalText"),
7823
+ onClick: () => applyTableCellAttribute(editor, "textDirection", null),
7824
+ active: currentCellTextDirection === "horizontal"
7825
+ }
7826
+ ),
7827
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7828
+ DropdownMenuItem,
7829
+ {
7830
+ icon: import_lucide_react52.ArrowDown,
7831
+ label: t("tableMenu.verticalText"),
7832
+ onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
7833
+ active: currentCellTextDirection === "vertical"
7834
+ }
7835
+ )
7836
+ ]
7837
+ }
7838
+ ),
7839
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7840
+ ToolbarButton,
7841
+ {
7842
+ onClick: () => applyTableCellAttribute(editor, "textWrap", currentCellTextWrap === "nowrap" ? "wrap" : "nowrap"),
7843
+ active: currentCellTextWrap !== "nowrap",
7844
+ title: currentCellTextWrap === "nowrap" ? t("tableMenu.wrapText") : t("tableMenu.noWrapText"),
7845
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.WrapText, { className: "h-4 w-4" })
7846
+ }
7847
+ )
7848
+ ] })
7825
7849
  ] }),
7826
7850
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
7827
7851
  /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
@@ -8208,8 +8232,6 @@ var init_editor_styles = __esm({
8208
8232
  "[&_table]:table-fixed",
8209
8233
  "[&_table]:overflow-hidden",
8210
8234
  "[&_table]:select-text",
8211
- "[&_table[data-table-align]]:w-max",
8212
- "[&_table[data-table-align]]:max-w-full",
8213
8235
  "[&_table[data-table-align='center']]:mx-auto",
8214
8236
  "[&_table[data-table-align='right']]:ml-auto",
8215
8237
  "[&_table[data-table-align='right']]:mr-0",
@@ -8219,6 +8241,11 @@ var init_editor_styles = __esm({
8219
8241
  "[&_td]:select-text",
8220
8242
  "[&_td]:px-2",
8221
8243
  "[&_td]:py-0",
8244
+ "[&_td]:whitespace-normal",
8245
+ "[&_td]:[overflow-wrap:anywhere]",
8246
+ "[&_td]:[word-break:normal]",
8247
+ "[&_td[data-text-wrap='nowrap']]:whitespace-nowrap",
8248
+ "[&_td[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
8222
8249
  "[&_td_p]:my-0",
8223
8250
  "[&_th]:relative",
8224
8251
  "[&_th]:align-top",
@@ -8226,6 +8253,11 @@ var init_editor_styles = __esm({
8226
8253
  "[&_th]:select-text",
8227
8254
  "[&_th]:px-2",
8228
8255
  "[&_th]:py-0",
8256
+ "[&_th]:whitespace-normal",
8257
+ "[&_th]:[overflow-wrap:anywhere]",
8258
+ "[&_th]:[word-break:normal]",
8259
+ "[&_th[data-text-wrap='nowrap']]:whitespace-nowrap",
8260
+ "[&_th[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
8229
8261
  "[&_th_p]:my-0",
8230
8262
  "[&_td[data-formula]]:pr-7",
8231
8263
  "[&_th[data-formula]]:pr-7",
@@ -32938,7 +32970,7 @@ var import_react85 = require("@tiptap/react");
32938
32970
  init_cn();
32939
32971
 
32940
32972
  // src/components/UEditor/extensions.ts
32941
- var import_core19 = require("@tiptap/core");
32973
+ var import_core20 = require("@tiptap/core");
32942
32974
  var import_extension_document = require("@tiptap/extension-document");
32943
32975
  var import_extension_paragraph = require("@tiptap/extension-paragraph");
32944
32976
  var import_extension_text = require("@tiptap/extension-text");
@@ -32955,7 +32987,7 @@ var import_extension_task_list = require("@tiptap/extension-task-list");
32955
32987
  var import_extension_task_item = require("@tiptap/extension-task-item");
32956
32988
  var import_extension_blockquote = require("@tiptap/extension-blockquote");
32957
32989
  var import_extension_code = require("@tiptap/extension-code");
32958
- var import_core20 = require("@tiptap/core");
32990
+ var import_core21 = require("@tiptap/core");
32959
32991
  var import_react69 = require("@tiptap/react");
32960
32992
 
32961
32993
  // src/components/UEditor/callout.ts
@@ -35778,6 +35810,7 @@ var Indent = import_core16.Extension.create({
35778
35810
  var indent_default = Indent;
35779
35811
 
35780
35812
  // src/components/UEditor/table-align.ts
35813
+ var import_core17 = require("@tiptap/core");
35781
35814
  var import_extension_table = require("@tiptap/extension-table");
35782
35815
  var import_state7 = require("@tiptap/pm/state");
35783
35816
  var import_tables3 = require("@tiptap/pm/tables");
@@ -35788,12 +35821,13 @@ var import_view2 = require("@tiptap/pm/view");
35788
35821
  var import_tables2 = require("@tiptap/pm/tables");
35789
35822
  var DEFAULT_TABLE_COLUMN_WIDTH = 100;
35790
35823
  var MIN_RESIZED_TABLE_COLUMN_WIDTH = 25;
35791
- function getDynamicColumnMinWidth(startWidth, fallbackMinWidth) {
35792
- return Math.max(fallbackMinWidth, Math.round(startWidth / 3));
35824
+ function getColumnResizeMinWidth(configuredMinWidth) {
35825
+ const normalizedMinWidth = Number.isFinite(configuredMinWidth) && configuredMinWidth > 0 ? Math.round(configuredMinWidth) : MIN_RESIZED_TABLE_COLUMN_WIDTH;
35826
+ return Math.max(MIN_RESIZED_TABLE_COLUMN_WIDTH, normalizedMinWidth);
35793
35827
  }
35794
35828
  function setColumnStyle(column, width) {
35795
35829
  if (width == null) {
35796
- column.style.width = "";
35830
+ column.style.width = `${DEFAULT_TABLE_COLUMN_WIDTH}px`;
35797
35831
  column.style.minWidth = `${DEFAULT_TABLE_COLUMN_WIDTH}px`;
35798
35832
  return;
35799
35833
  }
@@ -35805,7 +35839,6 @@ function isTableColumnElement(node) {
35805
35839
  }
35806
35840
  function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue) {
35807
35841
  let totalWidth = 0;
35808
- let fixedWidth = true;
35809
35842
  let nextDOM = colgroup.firstChild;
35810
35843
  const row = node.firstChild;
35811
35844
  if (row) {
@@ -35815,9 +35848,6 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
35815
35848
  const rawWidth = overrideCol === col ? overrideValue : colwidth?.[spanIndex];
35816
35849
  const width = rawWidth ? Math.max(rawWidth, MIN_RESIZED_TABLE_COLUMN_WIDTH) : null;
35817
35850
  totalWidth += width ?? DEFAULT_TABLE_COLUMN_WIDTH;
35818
- if (!width) {
35819
- fixedWidth = false;
35820
- }
35821
35851
  const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(document.createElement("col"));
35822
35852
  setColumnStyle(colElement, width);
35823
35853
  nextDOM = colElement.nextSibling;
@@ -35830,11 +35860,10 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
35830
35860
  nextDOM = after;
35831
35861
  }
35832
35862
  const hasUserWidth = typeof node.attrs.style === "string" && /\bwidth\s*:/i.test(node.attrs.style);
35833
- if (fixedWidth && !hasUserWidth) {
35863
+ if (!hasUserWidth) {
35834
35864
  table.style.width = `${totalWidth}px`;
35835
35865
  table.style.minWidth = "";
35836
35866
  } else {
35837
- table.style.width = "";
35838
35867
  table.style.minWidth = `${totalWidth}px`;
35839
35868
  }
35840
35869
  }
@@ -35847,6 +35876,7 @@ var UEditorTableView = class {
35847
35876
  if (node.attrs.style) {
35848
35877
  this.table.style.cssText = node.attrs.style;
35849
35878
  }
35879
+ this.table.style.tableLayout = "fixed";
35850
35880
  this.colgroup = this.table.appendChild(document.createElement("colgroup"));
35851
35881
  updateDynamicColumns(node, this.colgroup, this.table);
35852
35882
  this.contentDOM = this.table.appendChild(document.createElement("tbody"));
@@ -36028,7 +36058,7 @@ function handleMouseDown(view, event, cellMinWidth) {
36028
36058
  colspan: attrs.colspan ?? 1,
36029
36059
  colwidth: attrs.colwidth
36030
36060
  });
36031
- const minWidth = getDynamicColumnMinWidth(width, cellMinWidth);
36061
+ const minWidth = getColumnResizeMinWidth(cellMinWidth);
36032
36062
  const dragging = {
36033
36063
  startX: event.clientX,
36034
36064
  startWidth: width,
@@ -36157,15 +36187,37 @@ function parseTableAlign(element) {
36157
36187
  function renderTableAlignStyle(tableAlign) {
36158
36188
  switch (tableAlign) {
36159
36189
  case "center":
36160
- return "width: max-content; max-width: 100%; margin-left: auto; margin-right: auto;";
36190
+ return "table-layout: fixed; margin-left: auto; margin-right: auto;";
36161
36191
  case "right":
36162
- return "width: max-content; max-width: 100%; margin-left: auto; margin-right: 0;";
36192
+ return "table-layout: fixed; margin-left: auto; margin-right: 0;";
36163
36193
  case "left":
36164
- return "width: max-content; max-width: 100%; margin-left: 0; margin-right: auto;";
36194
+ return "table-layout: fixed; margin-left: 0; margin-right: auto;";
36165
36195
  default:
36166
36196
  return "";
36167
36197
  }
36168
36198
  }
36199
+ function createUEditorColGroup(node) {
36200
+ const columns = [];
36201
+ let totalWidth = 0;
36202
+ const firstRow = node.firstChild;
36203
+ if (firstRow) {
36204
+ for (let cellIndex = 0; cellIndex < firstRow.childCount; cellIndex += 1) {
36205
+ const cell = firstRow.child(cellIndex);
36206
+ const colspan = Math.max(1, Number(cell.attrs.colspan) || 1);
36207
+ const colwidth = Array.isArray(cell.attrs.colwidth) ? cell.attrs.colwidth : [];
36208
+ for (let spanIndex = 0; spanIndex < colspan; spanIndex += 1) {
36209
+ const storedWidth = Number(colwidth[spanIndex]);
36210
+ const width = Number.isFinite(storedWidth) && storedWidth > 0 ? Math.max(MIN_RESIZED_TABLE_COLUMN_WIDTH, Math.round(storedWidth)) : DEFAULT_TABLE_COLUMN_WIDTH;
36211
+ totalWidth += width;
36212
+ columns.push(["col", { style: `width: ${width}px; min-width: ${width}px;`, width: String(width) }]);
36213
+ }
36214
+ }
36215
+ }
36216
+ return {
36217
+ colgroup: ["colgroup", {}, ...columns],
36218
+ tableWidth: totalWidth > 0 ? `${totalWidth}px` : ""
36219
+ };
36220
+ }
36169
36221
  var UEditorTable = import_extension_table.Table.extend({
36170
36222
  addGlobalAttributes() {
36171
36223
  return [
@@ -36219,6 +36271,18 @@ var UEditorTable = import_extension_table.Table.extend({
36219
36271
  }
36220
36272
  };
36221
36273
  },
36274
+ renderHTML({ node, HTMLAttributes }) {
36275
+ const { colgroup, tableWidth } = createUEditorColGroup(node);
36276
+ const table = [
36277
+ "table",
36278
+ (0, import_core17.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
36279
+ style: tableWidth ? `width: ${tableWidth};` : "table-layout: fixed;"
36280
+ }),
36281
+ colgroup,
36282
+ ["tbody", 0]
36283
+ ];
36284
+ return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, table] : table;
36285
+ },
36222
36286
  addProseMirrorPlugins() {
36223
36287
  const isResizable = this.options.resizable && this.editor.isEditable;
36224
36288
  return [
@@ -36372,7 +36436,7 @@ var CodeBlockView = ({
36372
36436
  };
36373
36437
 
36374
36438
  // src/components/UEditor/optimized-lowlight.ts
36375
- var import_core17 = require("@tiptap/core");
36439
+ var import_core18 = require("@tiptap/core");
36376
36440
  var import_state8 = require("@tiptap/pm/state");
36377
36441
  var import_view3 = require("@tiptap/pm/view");
36378
36442
  function parseHighlightNodes(nodes, inheritedClasses = []) {
@@ -36419,7 +36483,7 @@ function buildLowlightDecorations({
36419
36483
  nodeName
36420
36484
  }) {
36421
36485
  const decorations = [];
36422
- for (const block of (0, import_core17.findChildren)(doc, (node) => node.type.name === nodeName)) {
36486
+ for (const block of (0, import_core18.findChildren)(doc, (node) => node.type.name === nodeName)) {
36423
36487
  let from = block.pos + 1;
36424
36488
  const language = block.node.attrs.language || defaultLanguage;
36425
36489
  const result = highlightCode(lowlight, language, block.node.textContent);
@@ -36560,7 +36624,7 @@ function createOptimizedLowlightPlugin({
36560
36624
  }
36561
36625
 
36562
36626
  // src/components/UEditor/table-formula-recalculation.ts
36563
- var import_core18 = require("@tiptap/core");
36627
+ var import_core19 = require("@tiptap/core");
36564
36628
  var import_state11 = require("@tiptap/pm/state");
36565
36629
 
36566
36630
  // src/components/UEditor/table-formula-commands.ts
@@ -37584,7 +37648,7 @@ function recalculateAllTableFormulas(editor) {
37584
37648
  }
37585
37649
 
37586
37650
  // src/components/UEditor/table-formula-recalculation.ts
37587
- var TableFormulaRecalculation = import_core18.Extension.create({
37651
+ var TableFormulaRecalculation = import_core19.Extension.create({
37588
37652
  name: "tableFormulaRecalculation",
37589
37653
  addProseMirrorPlugins() {
37590
37654
  return [
@@ -37615,6 +37679,21 @@ function getFormulaStateAttributes(attributes) {
37615
37679
  "data-formula-state": computedValue.startsWith("#") ? "error" : "computed"
37616
37680
  };
37617
37681
  }
37682
+ function normalizeTableCellTextWrap(value) {
37683
+ return value === "nowrap" ? "nowrap" : "wrap";
37684
+ }
37685
+ function parseTableCellTextWrap(element) {
37686
+ if (element.getAttribute("data-text-wrap") === "nowrap" || element.style.whiteSpace === "nowrap") {
37687
+ return "nowrap";
37688
+ }
37689
+ return "wrap";
37690
+ }
37691
+ function renderTableCellTextWrap(attributes) {
37692
+ return normalizeTableCellTextWrap(attributes.textWrap) === "nowrap" ? { "data-text-wrap": "nowrap" } : {};
37693
+ }
37694
+ function getTableCellTextWrapStyle(value) {
37695
+ return normalizeTableCellTextWrap(value) === "nowrap" ? "white-space: nowrap; overflow-wrap: normal; word-break: normal" : "white-space: normal; overflow-wrap: anywhere; word-break: normal";
37696
+ }
37618
37697
  var CustomTableCell = import_extension_table_cell.TableCell.extend({
37619
37698
  addAttributes() {
37620
37699
  return {
@@ -37715,6 +37794,11 @@ var CustomTableCell = import_extension_table_cell.TableCell.extend({
37715
37794
  default: null,
37716
37795
  parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
37717
37796
  renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
37797
+ },
37798
+ textWrap: {
37799
+ default: "wrap",
37800
+ parseHTML: parseTableCellTextWrap,
37801
+ renderHTML: renderTableCellTextWrap
37718
37802
  }
37719
37803
  };
37720
37804
  },
@@ -37726,6 +37810,7 @@ var CustomTableCell = import_extension_table_cell.TableCell.extend({
37726
37810
  const borderWidth = HTMLAttributes["data-border-width"];
37727
37811
  const verticalAlign = HTMLAttributes["data-vertical-align"];
37728
37812
  const textDirection = HTMLAttributes["data-text-direction"];
37813
+ const textWrap = HTMLAttributes["data-text-wrap"];
37729
37814
  let mergedStyle = style;
37730
37815
  if (bg) mergedStyle += `; background-color: ${bg}`;
37731
37816
  if (borderColor) mergedStyle += `; border-color: ${borderColor}`;
@@ -37733,10 +37818,11 @@ var CustomTableCell = import_extension_table_cell.TableCell.extend({
37733
37818
  if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
37734
37819
  if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
37735
37820
  if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
37821
+ mergedStyle += `; ${getTableCellTextWrapStyle(textWrap)}`;
37736
37822
  mergedStyle = mergedStyle.replace(/^;/, "").trim();
37737
37823
  return [
37738
37824
  "td",
37739
- (0, import_core19.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
37825
+ (0, import_core20.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
37740
37826
  0
37741
37827
  ];
37742
37828
  }
@@ -37841,6 +37927,11 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
37841
37927
  default: null,
37842
37928
  parseHTML: (element) => element.getAttribute("data-text-direction") === "vertical" || ["sideways-lr", "vertical-lr", "vertical-rl"].includes(element.style.writingMode) ? "vertical" : null,
37843
37929
  renderHTML: (attributes) => attributes.textDirection === "vertical" ? { "data-text-direction": "vertical" } : {}
37930
+ },
37931
+ textWrap: {
37932
+ default: "wrap",
37933
+ parseHTML: parseTableCellTextWrap,
37934
+ renderHTML: renderTableCellTextWrap
37844
37935
  }
37845
37936
  };
37846
37937
  },
@@ -37852,6 +37943,7 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
37852
37943
  const borderWidth = HTMLAttributes["data-border-width"];
37853
37944
  const verticalAlign = HTMLAttributes["data-vertical-align"];
37854
37945
  const textDirection = HTMLAttributes["data-text-direction"];
37946
+ const textWrap = HTMLAttributes["data-text-wrap"];
37855
37947
  let mergedStyle = style;
37856
37948
  if (bg) mergedStyle += `; background-color: ${bg}`;
37857
37949
  if (borderColor) mergedStyle += `; border-color: ${borderColor}`;
@@ -37859,10 +37951,11 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
37859
37951
  if (borderWidth) mergedStyle += `; border-width: ${borderWidth}`;
37860
37952
  if (verticalAlign) mergedStyle += `; vertical-align: ${verticalAlign}`;
37861
37953
  if (textDirection === "vertical") mergedStyle += "; writing-mode: sideways-lr; text-orientation: mixed";
37954
+ mergedStyle += `; ${getTableCellTextWrapStyle(textWrap)}`;
37862
37955
  mergedStyle = mergedStyle.replace(/^;/, "").trim();
37863
37956
  return [
37864
37957
  "th",
37865
- (0, import_core19.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
37958
+ (0, import_core20.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
37866
37959
  0
37867
37960
  ];
37868
37961
  }
@@ -37870,15 +37963,15 @@ var CustomTableHeader = import_extension_table_header.TableHeader.extend({
37870
37963
  var CustomTaskList = import_extension_task_list.TaskList.extend({
37871
37964
  addInputRules() {
37872
37965
  return [
37873
- (0, import_core20.wrappingInputRule)({
37966
+ (0, import_core21.wrappingInputRule)({
37874
37967
  find: /^\s*(\[ \]|\[\])\s$/,
37875
37968
  type: this.type
37876
37969
  }),
37877
- (0, import_core20.wrappingInputRule)({
37970
+ (0, import_core21.wrappingInputRule)({
37878
37971
  find: /^\s*(-\s*\[ \]|-\s*\[\])\s$/,
37879
37972
  type: this.type
37880
37973
  }),
37881
- (0, import_core20.wrappingInputRule)({
37974
+ (0, import_core21.wrappingInputRule)({
37882
37975
  find: /^\s*(\*\s*\[ \]|-\s*\[\])\s$/,
37883
37976
  type: this.type
37884
37977
  })
@@ -38024,7 +38117,8 @@ function buildUEditorExtensions({
38024
38117
  handleWidth: 10,
38025
38118
  allowTableNodeSelection: true,
38026
38119
  HTMLAttributes: {
38027
- class: "border-collapse my-4"
38120
+ class: "border-collapse my-4",
38121
+ style: "table-layout: fixed;"
38028
38122
  }
38029
38123
  }),
38030
38124
  table_row_default,
@@ -38437,6 +38531,7 @@ var BubbleMenuContent = ({
38437
38531
  const [activeBorderPosition, setActiveBorderPosition] = (0, import_react75.useState)("all");
38438
38532
  const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
38439
38533
  const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
38534
+ const currentCellTextWrap = normalizeStyleValue(editor.getAttributes("tableCell").textWrap || editor.getAttributes("tableHeader").textWrap) || "wrap";
38440
38535
  const isInTable3 = (0, import_tables8.isInTable)(editor.state);
38441
38536
  const canMergeCells = isInTable3 && editor.can().mergeCells();
38442
38537
  const canSplitCell = isInTable3 && editor.can().splitCell();
@@ -39097,6 +39192,20 @@ var BubbleMenuContent = ({
39097
39192
  children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.TableCellsMerge, { className: "w-4 h-4" })
39098
39193
  }
39099
39194
  ),
39195
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
39196
+ ToolbarButton,
39197
+ {
39198
+ onClick: () => applyTableCellAttribute2(
39199
+ editor,
39200
+ "textWrap",
39201
+ currentCellTextWrap === "nowrap" ? "wrap" : "nowrap",
39202
+ { focus: false }
39203
+ ),
39204
+ active: currentCellTextWrap !== "nowrap",
39205
+ title: currentCellTextWrap === "nowrap" ? t("tableMenu.wrapText") : t("tableMenu.noWrapText"),
39206
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.WrapText, { className: "h-4 w-4" })
39207
+ }
39208
+ ),
39100
39209
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
39101
39210
  DropdownMenu,
39102
39211
  {