@underverse-ui/underverse 1.0.204 → 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.
Files changed (31) hide show
  1. package/api-reference.json +1 -1
  2. package/dist/{EmojiPicker-UN6N7YVB.js → EmojiPicker-FEJJDAWZ.js} +4 -4
  3. package/dist/{chunk-CC3QO2YM.js → chunk-4E43DRP2.js} +243 -57
  4. package/dist/chunk-4E43DRP2.js.map +1 -0
  5. package/dist/{chunk-KFTYWTJR.js → chunk-AMAILXHP.js} +81 -36
  6. package/dist/chunk-AMAILXHP.js.map +1 -0
  7. package/dist/{chunk-GSBRTFP2.js → chunk-BRDGIALS.js} +28 -17
  8. package/dist/chunk-BRDGIALS.js.map +1 -0
  9. package/dist/{chunk-ZUAIBY2Z.js → chunk-CYCBSKWI.js} +2 -2
  10. package/dist/{chunk-CKKLFVOY.js → chunk-F6A7HJE4.js} +3 -3
  11. package/dist/{chunk-QVQTWZ24.js → chunk-GKY5DHGR.js} +3 -3
  12. package/dist/index.cjs +328 -90
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +16 -0
  15. package/dist/index.d.ts +16 -0
  16. package/dist/index.js +6 -6
  17. package/dist/{menu-bar-6U5S4PS7.js → menu-bar-6GS5LLTD.js} +4 -4
  18. package/dist/ueditor.cjs +338 -101
  19. package/dist/ueditor.cjs.map +1 -1
  20. package/dist/ueditor.d.cts +6 -0
  21. package/dist/ueditor.d.ts +6 -0
  22. package/dist/ueditor.js +4 -4
  23. package/package.json +1 -1
  24. package/dist/chunk-CC3QO2YM.js.map +0 -1
  25. package/dist/chunk-GSBRTFP2.js.map +0 -1
  26. package/dist/chunk-KFTYWTJR.js.map +0 -1
  27. /package/dist/{EmojiPicker-UN6N7YVB.js.map → EmojiPicker-FEJJDAWZ.js.map} +0 -0
  28. /package/dist/{chunk-ZUAIBY2Z.js.map → chunk-CYCBSKWI.js.map} +0 -0
  29. /package/dist/{chunk-CKKLFVOY.js.map → chunk-F6A7HJE4.js.map} +0 -0
  30. /package/dist/{chunk-QVQTWZ24.js.map → chunk-GKY5DHGR.js.map} +0 -0
  31. /package/dist/{menu-bar-6U5S4PS7.js.map → menu-bar-6GS5LLTD.js.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  mergeRefs,
6
6
  setRefValue,
7
7
  useSmartTranslations
8
- } from "./chunk-GSBRTFP2.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
 
@@ -2611,6 +2612,25 @@ function resolveEventElement(target) {
2611
2612
  if (target instanceof Node) return target.parentElement;
2612
2613
  return null;
2613
2614
  }
2615
+ function isPointOverRenderedText(root, clientX, clientY) {
2616
+ const view = root.ownerDocument.defaultView;
2617
+ if (!view) return false;
2618
+ const walker = root.ownerDocument.createTreeWalker(root, view.NodeFilter.SHOW_TEXT);
2619
+ let textNode = walker.nextNode();
2620
+ while (textNode) {
2621
+ if (textNode.textContent?.length) {
2622
+ const range = root.ownerDocument.createRange();
2623
+ range.selectNodeContents(textNode);
2624
+ const textRects = Array.from(range.getClientRects());
2625
+ range.detach?.();
2626
+ if (textRects.some((rect) => clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom)) {
2627
+ return true;
2628
+ }
2629
+ }
2630
+ textNode = walker.nextNode();
2631
+ }
2632
+ return false;
2633
+ }
2614
2634
  function getSelectionTableCell(view) {
2615
2635
  const browserSelection = window.getSelection();
2616
2636
  const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
@@ -2722,16 +2742,19 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
2722
2742
  const tableDom = editor.view.nodeDOM(tableInfo.pos);
2723
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);
2724
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
+ }
2725
2752
  if (tableAlign) {
2726
2753
  tableElement.setAttribute("data-table-align", tableAlign);
2727
- tableElement.style.width = "max-content";
2728
- tableElement.style.maxWidth = "100%";
2729
2754
  tableElement.style.marginLeft = tableAlign === "center" || tableAlign === "right" ? "auto" : "0";
2730
2755
  tableElement.style.marginRight = tableAlign === "center" ? "auto" : tableAlign === "right" ? "0" : "auto";
2731
2756
  } else {
2732
2757
  tableElement.removeAttribute("data-table-align");
2733
- tableElement.style.removeProperty("width");
2734
- tableElement.style.removeProperty("max-width");
2735
2758
  tableElement.style.removeProperty("margin-left");
2736
2759
  tableElement.style.removeProperty("margin-right");
2737
2760
  }
@@ -3174,6 +3197,7 @@ function computeEditorUiRenderState(editor) {
3174
3197
  formula: tableCell.formula ?? tableHeader.formula ?? null,
3175
3198
  numberFormat: tableCell.numberFormat ?? tableHeader.numberFormat ?? null,
3176
3199
  textDirection: tableCell.textDirection ?? tableHeader.textDirection ?? null,
3200
+ textWrap: tableCell.textWrap ?? tableHeader.textWrap ?? "wrap",
3177
3201
  verticalAlign: tableCell.verticalAlign ?? tableHeader.verticalAlign ?? null
3178
3202
  },
3179
3203
  can: {
@@ -3341,6 +3365,7 @@ var EditorToolbar = ({
3341
3365
  const canSplitCell = hasTableContext && editor.can().splitCell();
3342
3366
  const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
3343
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";
3344
3369
  const currentFontFamily = normalizeStyleValue(textStyleAttrs.fontFamily);
3345
3370
  const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
3346
3371
  const currentTextColor = normalizeStyleValue(textStyleAttrs.color) || "inherit";
@@ -3851,33 +3876,44 @@ var EditorToolbar = ({
3851
3876
  ]
3852
3877
  }
3853
3878
  ),
3854
- hasTableContext && /* @__PURE__ */ jsxs5(
3855
- DropdownMenu,
3856
- {
3857
- trigger: /* @__PURE__ */ jsx7(ToolbarButton, { onClick: () => {
3858
- }, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ jsx7(ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx7(ArrowRight, { className: "w-4 h-4" }) }),
3859
- children: [
3860
- /* @__PURE__ */ jsx7(
3861
- DropdownMenuItem,
3862
- {
3863
- icon: ArrowRight,
3864
- label: t("tableMenu.horizontalText"),
3865
- onClick: () => applyTableCellAttribute(editor, "textDirection", null),
3866
- active: currentCellTextDirection === "horizontal"
3867
- }
3868
- ),
3869
- /* @__PURE__ */ jsx7(
3870
- DropdownMenuItem,
3871
- {
3872
- icon: ArrowDown,
3873
- label: t("tableMenu.verticalText"),
3874
- onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
3875
- active: currentCellTextDirection === "vertical"
3876
- }
3877
- )
3878
- ]
3879
- }
3880
- )
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
+ ] })
3881
3917
  ] }),
3882
3918
  /* @__PURE__ */ jsx7(ToolbarDivider, {}),
3883
3919
  /* @__PURE__ */ jsxs5(
@@ -4257,8 +4293,6 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
4257
4293
  "[&_table]:table-fixed",
4258
4294
  "[&_table]:overflow-hidden",
4259
4295
  "[&_table]:select-text",
4260
- "[&_table[data-table-align]]:w-max",
4261
- "[&_table[data-table-align]]:max-w-full",
4262
4296
  "[&_table[data-table-align='center']]:mx-auto",
4263
4297
  "[&_table[data-table-align='right']]:ml-auto",
4264
4298
  "[&_table[data-table-align='right']]:mr-0",
@@ -4268,6 +4302,11 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
4268
4302
  "[&_td]:select-text",
4269
4303
  "[&_td]:px-2",
4270
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]",
4271
4310
  "[&_td_p]:my-0",
4272
4311
  "[&_th]:relative",
4273
4312
  "[&_th]:align-top",
@@ -4275,6 +4314,11 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
4275
4314
  "[&_th]:select-text",
4276
4315
  "[&_th]:px-2",
4277
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]",
4278
4322
  "[&_th_p]:my-0",
4279
4323
  "[&_td[data-formula]]:pr-7",
4280
4324
  "[&_th[data-formula]]:pr-7",
@@ -4437,6 +4481,7 @@ export {
4437
4481
  UEDITOR_TABLE_LAYOUT_CHANGE_EVENT,
4438
4482
  findTableRowNodeInfo,
4439
4483
  resolveEventElement,
4484
+ isPointOverRenderedText,
4440
4485
  getSelectionTableCell,
4441
4486
  isRowResizeHotspot,
4442
4487
  isColumnResizeHotspot,
@@ -4478,4 +4523,4 @@ export {
4478
4523
  EditorToolbar,
4479
4524
  UEDITOR_PROSEMIRROR_CLASS_NAME
4480
4525
  };
4481
- //# sourceMappingURL=chunk-KFTYWTJR.js.map
4526
+ //# sourceMappingURL=chunk-AMAILXHP.js.map