@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.
@@ -5,7 +5,7 @@ import {
5
5
  mergeRefs,
6
6
  setRefValue,
7
7
  useSmartTranslations
8
- } from "./chunk-XJR7E6QB.js";
8
+ } from "./chunk-BRDGIALS.js";
9
9
 
10
10
  // src/contexts/UnderverseConfigContext.tsx
11
11
  import * as React from "react";
@@ -2059,7 +2059,8 @@ import {
2059
2059
  Upload,
2060
2060
  AlignStartVertical,
2061
2061
  AlignCenterVertical,
2062
- AlignEndVertical
2062
+ AlignEndVertical,
2063
+ WrapText
2063
2064
  } from "lucide-react";
2064
2065
  import { setCellAttr } from "@tiptap/pm/tables";
2065
2066
 
@@ -2741,16 +2742,19 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
2741
2742
  const tableDom = editor.view.nodeDOM(tableInfo.pos);
2742
2743
  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);
2743
2744
  if (tableElement instanceof HTMLTableElement) {
2745
+ tableElement.style.tableLayout = "fixed";
2746
+ if (tableElement.style.width === "max-content") {
2747
+ tableElement.style.removeProperty("width");
2748
+ }
2749
+ if (tableElement.style.maxWidth === "100%") {
2750
+ tableElement.style.removeProperty("max-width");
2751
+ }
2744
2752
  if (tableAlign) {
2745
2753
  tableElement.setAttribute("data-table-align", tableAlign);
2746
- tableElement.style.width = "max-content";
2747
- tableElement.style.maxWidth = "100%";
2748
2754
  tableElement.style.marginLeft = tableAlign === "center" || tableAlign === "right" ? "auto" : "0";
2749
2755
  tableElement.style.marginRight = tableAlign === "center" ? "auto" : tableAlign === "right" ? "0" : "auto";
2750
2756
  } else {
2751
2757
  tableElement.removeAttribute("data-table-align");
2752
- tableElement.style.removeProperty("width");
2753
- tableElement.style.removeProperty("max-width");
2754
2758
  tableElement.style.removeProperty("margin-left");
2755
2759
  tableElement.style.removeProperty("margin-right");
2756
2760
  }
@@ -3193,6 +3197,7 @@ function computeEditorUiRenderState(editor) {
3193
3197
  formula: tableCell.formula ?? tableHeader.formula ?? null,
3194
3198
  numberFormat: tableCell.numberFormat ?? tableHeader.numberFormat ?? null,
3195
3199
  textDirection: tableCell.textDirection ?? tableHeader.textDirection ?? null,
3200
+ textWrap: tableCell.textWrap ?? tableHeader.textWrap ?? "wrap",
3196
3201
  verticalAlign: tableCell.verticalAlign ?? tableHeader.verticalAlign ?? null
3197
3202
  },
3198
3203
  can: {
@@ -3360,6 +3365,7 @@ var EditorToolbar = ({
3360
3365
  const canSplitCell = hasTableContext && editor.can().splitCell();
3361
3366
  const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
3362
3367
  const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
3368
+ const currentCellTextWrap = normalizeStyleValue(editor.getAttributes("tableCell").textWrap || editor.getAttributes("tableHeader").textWrap) || "wrap";
3363
3369
  const currentFontFamily = normalizeStyleValue(textStyleAttrs.fontFamily);
3364
3370
  const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
3365
3371
  const currentTextColor = normalizeStyleValue(textStyleAttrs.color) || "inherit";
@@ -3870,33 +3876,44 @@ var EditorToolbar = ({
3870
3876
  ]
3871
3877
  }
3872
3878
  ),
3873
- hasTableContext && /* @__PURE__ */ jsxs5(
3874
- DropdownMenu,
3875
- {
3876
- trigger: /* @__PURE__ */ jsx7(ToolbarButton, { onClick: () => {
3877
- }, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ jsx7(ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx7(ArrowRight, { className: "w-4 h-4" }) }),
3878
- children: [
3879
- /* @__PURE__ */ jsx7(
3880
- DropdownMenuItem,
3881
- {
3882
- icon: ArrowRight,
3883
- label: t("tableMenu.horizontalText"),
3884
- onClick: () => applyTableCellAttribute(editor, "textDirection", null),
3885
- active: currentCellTextDirection === "horizontal"
3886
- }
3887
- ),
3888
- /* @__PURE__ */ jsx7(
3889
- DropdownMenuItem,
3890
- {
3891
- icon: ArrowDown,
3892
- label: t("tableMenu.verticalText"),
3893
- onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
3894
- active: currentCellTextDirection === "vertical"
3895
- }
3896
- )
3897
- ]
3898
- }
3899
- )
3879
+ hasTableContext && /* @__PURE__ */ jsxs5(Fragment3, { children: [
3880
+ /* @__PURE__ */ jsxs5(
3881
+ DropdownMenu,
3882
+ {
3883
+ trigger: /* @__PURE__ */ jsx7(ToolbarButton, { onClick: () => {
3884
+ }, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ jsx7(ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx7(ArrowRight, { className: "w-4 h-4" }) }),
3885
+ children: [
3886
+ /* @__PURE__ */ jsx7(
3887
+ DropdownMenuItem,
3888
+ {
3889
+ icon: ArrowRight,
3890
+ label: t("tableMenu.horizontalText"),
3891
+ onClick: () => applyTableCellAttribute(editor, "textDirection", null),
3892
+ active: currentCellTextDirection === "horizontal"
3893
+ }
3894
+ ),
3895
+ /* @__PURE__ */ jsx7(
3896
+ DropdownMenuItem,
3897
+ {
3898
+ icon: ArrowDown,
3899
+ label: t("tableMenu.verticalText"),
3900
+ onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
3901
+ active: currentCellTextDirection === "vertical"
3902
+ }
3903
+ )
3904
+ ]
3905
+ }
3906
+ ),
3907
+ /* @__PURE__ */ jsx7(
3908
+ ToolbarButton,
3909
+ {
3910
+ onClick: () => applyTableCellAttribute(editor, "textWrap", currentCellTextWrap === "nowrap" ? "wrap" : "nowrap"),
3911
+ active: currentCellTextWrap !== "nowrap",
3912
+ title: currentCellTextWrap === "nowrap" ? t("tableMenu.wrapText") : t("tableMenu.noWrapText"),
3913
+ children: /* @__PURE__ */ jsx7(WrapText, { className: "h-4 w-4" })
3914
+ }
3915
+ )
3916
+ ] })
3900
3917
  ] }),
3901
3918
  /* @__PURE__ */ jsx7(ToolbarDivider, {}),
3902
3919
  /* @__PURE__ */ jsxs5(
@@ -4276,8 +4293,6 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
4276
4293
  "[&_table]:table-fixed",
4277
4294
  "[&_table]:overflow-hidden",
4278
4295
  "[&_table]:select-text",
4279
- "[&_table[data-table-align]]:w-max",
4280
- "[&_table[data-table-align]]:max-w-full",
4281
4296
  "[&_table[data-table-align='center']]:mx-auto",
4282
4297
  "[&_table[data-table-align='right']]:ml-auto",
4283
4298
  "[&_table[data-table-align='right']]:mr-0",
@@ -4287,6 +4302,11 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
4287
4302
  "[&_td]:select-text",
4288
4303
  "[&_td]:px-2",
4289
4304
  "[&_td]:py-0",
4305
+ "[&_td]:whitespace-normal",
4306
+ "[&_td]:[overflow-wrap:anywhere]",
4307
+ "[&_td]:[word-break:normal]",
4308
+ "[&_td[data-text-wrap='nowrap']]:whitespace-nowrap",
4309
+ "[&_td[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
4290
4310
  "[&_td_p]:my-0",
4291
4311
  "[&_th]:relative",
4292
4312
  "[&_th]:align-top",
@@ -4294,6 +4314,11 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
4294
4314
  "[&_th]:select-text",
4295
4315
  "[&_th]:px-2",
4296
4316
  "[&_th]:py-0",
4317
+ "[&_th]:whitespace-normal",
4318
+ "[&_th]:[overflow-wrap:anywhere]",
4319
+ "[&_th]:[word-break:normal]",
4320
+ "[&_th[data-text-wrap='nowrap']]:whitespace-nowrap",
4321
+ "[&_th[data-text-wrap='nowrap']]:[overflow-wrap:normal]",
4297
4322
  "[&_th_p]:my-0",
4298
4323
  "[&_td[data-formula]]:pr-7",
4299
4324
  "[&_th[data-formula]]:pr-7",
@@ -4498,4 +4523,4 @@ export {
4498
4523
  EditorToolbar,
4499
4524
  UEDITOR_PROSEMIRROR_CLASS_NAME
4500
4525
  };
4501
- //# sourceMappingURL=chunk-MJV7ETJM.js.map
4526
+ //# sourceMappingURL=chunk-AMAILXHP.js.map