@underverse-ui/underverse 2.0.12 → 2.0.14

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-FFNIUMI3.js → EmojiPicker-CGMUDB4I.js} +4 -4
  3. package/dist/{chunk-EVS5YWTO.js → chunk-3Q5EE2ZA.js} +172 -79
  4. package/dist/chunk-3Q5EE2ZA.js.map +1 -0
  5. package/dist/{chunk-Q6BQUWKB.js → chunk-DCFQGH3K.js} +3 -3
  6. package/dist/{chunk-VNSCI3OK.js → chunk-DXLSCUYA.js} +2 -2
  7. package/dist/{chunk-HEYNAGQD.js → chunk-N2S6RI4Y.js} +3 -3
  8. package/dist/{chunk-P2RLTURA.js → chunk-PDYEK7HL.js} +202 -56
  9. package/dist/chunk-PDYEK7HL.js.map +1 -0
  10. package/dist/{chunk-PYC5EY5W.js → chunk-PV2G2XME.js} +13 -5
  11. package/dist/chunk-PV2G2XME.js.map +1 -0
  12. package/dist/index.cjs +369 -127
  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-JSXW6AXW.js → menu-bar-55SAOAX6.js} +4 -4
  18. package/dist/ueditor.cjs +369 -127
  19. package/dist/ueditor.cjs.map +1 -1
  20. package/dist/ueditor.d.cts +3 -0
  21. package/dist/ueditor.d.ts +3 -0
  22. package/dist/ueditor.js +4 -4
  23. package/package.json +1 -1
  24. package/dist/chunk-EVS5YWTO.js.map +0 -1
  25. package/dist/chunk-P2RLTURA.js.map +0 -1
  26. package/dist/chunk-PYC5EY5W.js.map +0 -1
  27. /package/dist/{EmojiPicker-FFNIUMI3.js.map → EmojiPicker-CGMUDB4I.js.map} +0 -0
  28. /package/dist/{chunk-Q6BQUWKB.js.map → chunk-DCFQGH3K.js.map} +0 -0
  29. /package/dist/{chunk-VNSCI3OK.js.map → chunk-DXLSCUYA.js.map} +0 -0
  30. /package/dist/{chunk-HEYNAGQD.js.map → chunk-N2S6RI4Y.js.map} +0 -0
  31. /package/dist/{menu-bar-JSXW6AXW.js.map → menu-bar-55SAOAX6.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getPanelBorderRadiusClass,
3
3
  useUnderverseUIConfig
4
- } from "./chunk-EVS5YWTO.js";
4
+ } from "./chunk-3Q5EE2ZA.js";
5
5
  import {
6
6
  cn,
7
7
  useGlobalI18n
8
- } from "./chunk-PYC5EY5W.js";
8
+ } from "./chunk-PV2G2XME.js";
9
9
 
10
10
  // src/components/Modal.tsx
11
11
  import * as React from "react";
@@ -196,4 +196,4 @@ var Modal_default = Modal;
196
196
  export {
197
197
  Modal_default
198
198
  };
199
- //# sourceMappingURL=chunk-Q6BQUWKB.js.map
199
+ //# sourceMappingURL=chunk-DCFQGH3K.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cn
3
- } from "./chunk-PYC5EY5W.js";
3
+ } from "./chunk-PV2G2XME.js";
4
4
 
5
5
  // src/components/emoji-ui.tsx
6
6
  import React from "react";
@@ -71,4 +71,4 @@ export {
71
71
  getEmojiImageUrl,
72
72
  EmojiGridButton
73
73
  };
74
- //# sourceMappingURL=chunk-VNSCI3OK.js.map
74
+ //# sourceMappingURL=chunk-DXLSCUYA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EmojiGridButton
3
- } from "./chunk-VNSCI3OK.js";
3
+ } from "./chunk-DXLSCUYA.js";
4
4
  import {
5
5
  EMOJI_LIST
6
6
  } from "./chunk-4TYW5K4J.js";
@@ -9,7 +9,7 @@ import {
9
9
  cn,
10
10
  formControlOutlineClass,
11
11
  useSmartTranslations
12
- } from "./chunk-PYC5EY5W.js";
12
+ } from "./chunk-PV2G2XME.js";
13
13
 
14
14
  // src/components/EmojiPicker.tsx
15
15
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -205,4 +205,4 @@ export {
205
205
  EmojiPicker,
206
206
  EmojiPicker_default
207
207
  };
208
- //# sourceMappingURL=chunk-HEYNAGQD.js.map
208
+ //# sourceMappingURL=chunk-N2S6RI4Y.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EmojiGridButton,
3
3
  formatEmojiCountLabel
4
- } from "./chunk-VNSCI3OK.js";
4
+ } from "./chunk-DXLSCUYA.js";
5
5
  import {
6
6
  COLUMN_RESIZE_LINE_THICKNESS,
7
7
  CellBgColorIcon,
@@ -41,26 +41,28 @@ import {
41
41
  getRelativeCellMetrics,
42
42
  getRelativeSelectedCellsMetrics,
43
43
  getSelectionTableCell,
44
- isColumnResizeHotspot,
45
44
  isPointOverRenderedText,
46
45
  isRowResizeHotspot,
46
+ isRowResizingGlobal,
47
47
  isSafeUEditorUrl,
48
48
  mergeTableCellsPreservingColumnWidths,
49
49
  normalizeStyleValue,
50
50
  resetImageSize,
51
+ resolveColumnResizeTarget,
51
52
  resolveEventElement,
53
+ resolveRowResizeTarget,
52
54
  runTableCommandAtCellPos,
53
55
  sanitizeUEditorUrl,
54
56
  useEditorColors,
55
57
  useSharedEditorUiRenderState
56
- } from "./chunk-EVS5YWTO.js";
58
+ } from "./chunk-3Q5EE2ZA.js";
57
59
  import {
58
60
  Tooltip,
59
61
  cn,
60
62
  formControlGroupOutlineClass,
61
63
  formControlOutlineClass,
62
64
  useSmartTranslations
63
- } from "./chunk-PYC5EY5W.js";
65
+ } from "./chunk-PV2G2XME.js";
64
66
 
65
67
  // src/components/UEditor/prepare-content-for-save.ts
66
68
  var MIME_EXTENSION_MAP = {
@@ -510,7 +512,7 @@ import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
510
512
  import React from "react";
511
513
  import { jsx } from "react/jsx-runtime";
512
514
  var LazyBaseEmojiPicker = React.lazy(async () => {
513
- const { EmojiPicker: EmojiPicker2 } = await import("./EmojiPicker-FFNIUMI3.js");
515
+ const { EmojiPicker: EmojiPicker2 } = await import("./EmojiPicker-CGMUDB4I.js");
514
516
  return { default: EmojiPicker2 };
515
517
  });
516
518
  var EmojiPicker = ({ onSelect }) => {
@@ -3315,7 +3317,7 @@ var indent_default = Indent;
3315
3317
  // src/components/UEditor/table-align.ts
3316
3318
  import { mergeAttributes as mergeAttributes7 } from "@tiptap/core";
3317
3319
  import { Table as Table2 } from "@tiptap/extension-table";
3318
- import { Plugin as Plugin4 } from "@tiptap/pm/state";
3320
+ import { Plugin as Plugin4, PluginKey as PluginKey5 } from "@tiptap/pm/state";
3319
3321
  import { tableEditing } from "@tiptap/pm/tables";
3320
3322
 
3321
3323
  // src/components/UEditor/table-column-resize.ts
@@ -3455,6 +3457,15 @@ function edgeCell(view, event, side, handleWidth) {
3455
3457
  const index = map.map.indexOf($cell.pos - start);
3456
3458
  return index % map.width === 0 ? -1 : start + map.map[index - 1];
3457
3459
  }
3460
+ var handleHoverTimer = null;
3461
+ var pendingHandleCell = -1;
3462
+ function clearHandleHoverTimer() {
3463
+ if (handleHoverTimer !== null) {
3464
+ window.clearTimeout(handleHoverTimer);
3465
+ handleHoverTimer = null;
3466
+ }
3467
+ pendingHandleCell = -1;
3468
+ }
3458
3469
  function updateHandle(view, value) {
3459
3470
  view.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value }));
3460
3471
  }
@@ -3469,19 +3480,43 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
3469
3480
  if (event.clientX - left <= handleWidth) cell = edgeCell(view, event, "left", handleWidth);
3470
3481
  else if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, "right", handleWidth);
3471
3482
  }
3472
- if (cell === pluginState.activeHandle) return;
3473
- if (!lastColumnResizable && cell !== -1) {
3483
+ if (cell === pluginState.activeHandle) {
3484
+ clearHandleHoverTimer();
3485
+ return;
3486
+ }
3487
+ if (cell === -1) {
3488
+ clearHandleHoverTimer();
3489
+ if (pluginState.activeHandle !== -1) {
3490
+ updateHandle(view, -1);
3491
+ }
3492
+ return;
3493
+ }
3494
+ if (!lastColumnResizable) {
3474
3495
  const $cell = view.state.doc.resolve(cell);
3475
3496
  const table = $cell.node(-1);
3476
3497
  const map = TableMap.get(table);
3477
3498
  const tableStart = $cell.start(-1);
3478
3499
  const nodeAfter = $cell.nodeAfter;
3479
3500
  if (!nodeAfter) return;
3480
- if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) return;
3501
+ if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) {
3502
+ clearHandleHoverTimer();
3503
+ if (pluginState.activeHandle !== -1) {
3504
+ updateHandle(view, -1);
3505
+ }
3506
+ return;
3507
+ }
3481
3508
  }
3482
- updateHandle(view, cell);
3509
+ if (pendingHandleCell === cell) return;
3510
+ clearHandleHoverTimer();
3511
+ pendingHandleCell = cell;
3512
+ handleHoverTimer = window.setTimeout(() => {
3513
+ handleHoverTimer = null;
3514
+ pendingHandleCell = -1;
3515
+ updateHandle(view, cell);
3516
+ }, 100);
3483
3517
  }
3484
3518
  function handleMouseLeave(view) {
3519
+ clearHandleHoverTimer();
3485
3520
  if (!view.editable) return;
3486
3521
  const pluginState = columnResizingPluginKey.getState(view.state);
3487
3522
  if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) {
@@ -3530,7 +3565,7 @@ function getColumnResizeGhost(view) {
3530
3565
  ghost.style.pointerEvents = "none";
3531
3566
  ghost.style.width = "2px";
3532
3567
  ghost.style.backgroundColor = "var(--primary, #2563eb)";
3533
- ghost.style.opacity = "1";
3568
+ ghost.style.opacity = "0.5";
3534
3569
  ghost.style.borderRadius = "9999px";
3535
3570
  ghost.style.boxShadow = "0 0 0 1px color-mix(in oklch, var(--background, #fff) 80%, transparent)";
3536
3571
  ghost.style.transform = "translateX(-1px)";
@@ -3559,6 +3594,7 @@ function showColumnResizeGhost(view, cell, dragging, width) {
3559
3594
  ghost.style.height = `${rect.height}px`;
3560
3595
  }
3561
3596
  function handleMouseDown(view, event, cellMinWidth) {
3597
+ clearHandleHoverTimer();
3562
3598
  if (!view.editable) return false;
3563
3599
  const win = view.dom.ownerDocument.defaultView ?? window;
3564
3600
  const pluginState = columnResizingPluginKey.getState(view.state);
@@ -3805,6 +3841,38 @@ var UEditorTable = Table2.extend({
3805
3841
  lastColumnResizable: this.options.lastColumnResizable
3806
3842
  })
3807
3843
  ] : [],
3844
+ new Plugin4({
3845
+ key: new PluginKey5("tableRowResizeInterceptor"),
3846
+ props: {
3847
+ handleDOMEvents: {
3848
+ mousedown(view, event) {
3849
+ if (event.button !== 0) return false;
3850
+ const target = resolveEventElement(event.target);
3851
+ const cell = target?.closest("th,td");
3852
+ if (cell instanceof HTMLElement && isRowResizeHotspot(cell, event.clientX, event.clientY)) {
3853
+ isRowResizingGlobal.active = true;
3854
+ return true;
3855
+ }
3856
+ return false;
3857
+ },
3858
+ mousemove(_view, event) {
3859
+ if (isRowResizingGlobal.active) {
3860
+ if (event.buttons === 0) {
3861
+ isRowResizingGlobal.active = false;
3862
+ return false;
3863
+ }
3864
+ event.preventDefault();
3865
+ return true;
3866
+ }
3867
+ return false;
3868
+ },
3869
+ mouseup() {
3870
+ isRowResizingGlobal.active = false;
3871
+ return false;
3872
+ }
3873
+ }
3874
+ }
3875
+ }),
3808
3876
  tableEditing({
3809
3877
  allowTableNodeSelection: this.options.allowTableNodeSelection
3810
3878
  }),
@@ -3944,7 +4012,7 @@ var CodeBlockView = ({
3944
4012
 
3945
4013
  // src/components/UEditor/optimized-lowlight.ts
3946
4014
  import { findChildren } from "@tiptap/core";
3947
- import { Plugin as Plugin5, PluginKey as PluginKey5 } from "@tiptap/pm/state";
4015
+ import { Plugin as Plugin5, PluginKey as PluginKey6 } from "@tiptap/pm/state";
3948
4016
  import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
3949
4017
  function parseHighlightNodes(nodes, inheritedClasses = []) {
3950
4018
  return nodes.flatMap((value) => {
@@ -4066,7 +4134,7 @@ function createOptimizedLowlightPlugin({
4066
4134
  lowlight,
4067
4135
  nodeName
4068
4136
  }) {
4069
- const pluginKey = new PluginKey5("ueditorLowlight");
4137
+ const pluginKey = new PluginKey6("ueditorLowlight");
4070
4138
  const createDecorations = (doc) => buildLowlightDecorations({
4071
4139
  defaultLanguage,
4072
4140
  doc,
@@ -6971,7 +7039,11 @@ var CustomBubbleMenu = ({
6971
7039
  setIsVisible(false);
6972
7040
  return;
6973
7041
  }
6974
- if (!keepOpenRef.current && (context2 === "none" || !view.hasFocus())) {
7042
+ const isInputFocused = () => {
7043
+ const active = document.activeElement;
7044
+ return Boolean(active && (menuRef.current?.contains(active) || active.closest?.("[data-ueditor-keep-open]")));
7045
+ };
7046
+ if (!keepOpenRef.current && !isInputFocused() && (context2 === "none" || !view.hasFocus())) {
6975
7047
  clearShowTimeout();
6976
7048
  setIsVisible(false);
6977
7049
  return;
@@ -7012,7 +7084,8 @@ var CustomBubbleMenu = ({
7012
7084
  }, SHOW_DELAY_MS);
7013
7085
  };
7014
7086
  const handleBlur = () => {
7015
- if (!keepOpenRef.current) {
7087
+ const isInputFocused = Boolean(document.activeElement && (menuRef.current?.contains(document.activeElement) || document.activeElement.closest?.("[data-ueditor-keep-open]")));
7088
+ if (!keepOpenRef.current && !isInputFocused) {
7016
7089
  clearShowTimeout();
7017
7090
  setIsVisible(false);
7018
7091
  }
@@ -7106,6 +7179,9 @@ var CustomBubbleMenu = ({
7106
7179
  } else if (target?.closest?.("[data-ueditor-keep-open]")) {
7107
7180
  setKeepOpen(true);
7108
7181
  }
7182
+ if (target && target.closest("input, textarea, select")) {
7183
+ return;
7184
+ }
7109
7185
  e.preventDefault();
7110
7186
  },
7111
7187
  children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ jsx12(
@@ -10264,7 +10340,7 @@ function createKey(name) {
10264
10340
  keys[name] = 0;
10265
10341
  return name + "$";
10266
10342
  }
10267
- var PluginKey6 = class {
10343
+ var PluginKey7 = class {
10268
10344
  /**
10269
10345
  Create a plugin key.
10270
10346
  */
@@ -10696,7 +10772,7 @@ function tableNodeTypes2(schema) {
10696
10772
  }
10697
10773
  return result;
10698
10774
  }
10699
- var tableEditingKey = new PluginKey6("selectingCells");
10775
+ var tableEditingKey = new PluginKey7("selectingCells");
10700
10776
  function cellAround2($pos) {
10701
10777
  for (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == "row") return $pos.node(0).resolve($pos.before(d + 1));
10702
10778
  return null;
@@ -10927,7 +11003,7 @@ var CellBookmark = class CellBookmark2 {
10927
11003
  else return Selection.near($headCell, 1);
10928
11004
  }
10929
11005
  };
10930
- var fixTablesKey = new PluginKey6("fix-tables");
11006
+ var fixTablesKey = new PluginKey7("fix-tables");
10931
11007
  function convertTableNodeToArrayOfRows(tableNode) {
10932
11008
  const map = TableMap3.get(tableNode);
10933
11009
  const rows = [];
@@ -11405,7 +11481,7 @@ function atEndOfCell(view, axis, dir) {
11405
11481
  }
11406
11482
  return null;
11407
11483
  }
11408
- var columnResizingPluginKey2 = new PluginKey6("tableColumnResizing");
11484
+ var columnResizingPluginKey2 = new PluginKey7("tableColumnResizing");
11409
11485
 
11410
11486
  // src/components/UEditor/table-controls.tsx
11411
11487
  import {
@@ -11856,6 +11932,8 @@ function TableDragPreview({
11856
11932
  import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
11857
11933
  var ADD_COLUMN_RAIL_GAP = 4;
11858
11934
  var ADD_ROW_RAIL_GAP = 4;
11935
+ var BUTTON_LONG_SIZE = 36;
11936
+ var BUTTON_SHORT_SIZE = 14;
11859
11937
  function TableAddRails({
11860
11938
  addColumnVisible,
11861
11939
  addRowVisible,
@@ -11868,10 +11946,10 @@ function TableAddRails({
11868
11946
  quickAddRowLabel
11869
11947
  }) {
11870
11948
  const visibleBounds = getVisibleTableBounds(layout);
11871
- const columnRailTop = visibleBounds.top;
11949
+ const columnRailTop = visibleBounds.top + Math.max(0, (visibleBounds.height - BUTTON_LONG_SIZE) / 2);
11872
11950
  const columnRailLeft = visibleBounds.right + ADD_COLUMN_RAIL_GAP;
11873
11951
  const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
11874
- const rowRailLeft = visibleBounds.left;
11952
+ const rowRailLeft = visibleBounds.left + Math.max(0, (visibleBounds.width - BUTTON_LONG_SIZE) / 2);
11875
11953
  const showColumnRail = controlsVisible || addColumnVisible;
11876
11954
  const showRowRail = controlsVisible || addRowVisible;
11877
11955
  return /* @__PURE__ */ jsxs13(Fragment4, { children: [
@@ -11896,15 +11974,15 @@ function TableAddRails({
11896
11974
  className: cn(
11897
11975
  "absolute z-30 inline-flex items-center justify-center rounded-md",
11898
11976
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
11899
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
11977
+ "transition-[opacity,transform,colors] duration-200 delay-100 ease-out cursor-pointer hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
11900
11978
  ),
11901
11979
  style: {
11902
- top: showColumnRail ? columnRailTop : columnRailTop + Math.max(0, visibleBounds.height / 2 - 24),
11980
+ top: columnRailTop,
11903
11981
  left: columnRailLeft,
11904
- width: showColumnRail ? 18 : 12,
11905
- height: showColumnRail ? visibleBounds.height : 48,
11982
+ width: BUTTON_SHORT_SIZE,
11983
+ height: BUTTON_LONG_SIZE,
11906
11984
  opacity: showColumnRail ? 1 : 0,
11907
- transform: showColumnRail ? "scale(1)" : "scale(0.92)",
11985
+ transform: showColumnRail ? "scale(1)" : "scale(0.85)",
11908
11986
  pointerEvents: showColumnRail ? "auto" : "none"
11909
11987
  },
11910
11988
  children: /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -11933,15 +12011,15 @@ function TableAddRails({
11933
12011
  className: cn(
11934
12012
  "absolute z-30 inline-flex items-center justify-center rounded-md",
11935
12013
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
11936
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
12014
+ "transition-[opacity,transform,colors] duration-200 delay-100 ease-out cursor-pointer hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
11937
12015
  ),
11938
12016
  style: {
11939
12017
  top: rowRailTop,
11940
- left: showRowRail ? rowRailLeft : rowRailLeft + Math.max(0, visibleBounds.width / 2 - 24),
11941
- width: showRowRail ? visibleBounds.width : 48,
11942
- height: showRowRail ? 16 : 12,
12018
+ left: rowRailLeft,
12019
+ width: BUTTON_LONG_SIZE,
12020
+ height: BUTTON_SHORT_SIZE,
11943
12021
  opacity: showRowRail ? 1 : 0,
11944
- transform: showRowRail ? "scale(1)" : "scale(0.92)",
12022
+ transform: showRowRail ? "scale(1)" : "scale(0.85)",
11945
12023
  pointerEvents: showRowRail ? "auto" : "none"
11946
12024
  },
11947
12025
  children: /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -12072,7 +12150,7 @@ function TableRowHandles({
12072
12150
  onStartDrag(rowHandle);
12073
12151
  },
12074
12152
  className: cn(
12075
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
12153
+ "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-200 delay-100 ease-out",
12076
12154
  visible ? "border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-foreground cursor-grab active:cursor-grabbing" : "border-transparent bg-transparent cursor-pointer"
12077
12155
  ),
12078
12156
  style: {
@@ -12147,7 +12225,7 @@ function TableColumnHandles({
12147
12225
  onStartDrag(columnHandle);
12148
12226
  },
12149
12227
  className: cn(
12150
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
12228
+ "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-200 delay-100 ease-out",
12151
12229
  visible ? "border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-foreground cursor-grab active:cursor-grabbing" : "border-transparent bg-transparent cursor-pointer"
12152
12230
  ),
12153
12231
  style: {
@@ -12534,7 +12612,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
12534
12612
  const updateHoverState = React10.useCallback((event) => {
12535
12613
  const activeLayout = layoutRef.current;
12536
12614
  const surface = containerRef.current;
12537
- if (!activeLayout || !surface || dragStateRef.current) {
12615
+ if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
12538
12616
  setHoverState(DEFAULT_TABLE_HOVER_STATE);
12539
12617
  return;
12540
12618
  }
@@ -12668,7 +12746,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
12668
12746
  return result;
12669
12747
  }, [editor, scheduleSyncFromSelection]);
12670
12748
  const canExpandTable = Boolean(layout);
12671
- const controlsVisible = dragPreview !== null;
12749
+ const controlsVisible = false;
12672
12750
  const tableMenuOpen = openMenuKey === "table";
12673
12751
  const startTableResize = React10.useCallback((event) => {
12674
12752
  if (event.button !== 0 || dragStateRef.current) return;
@@ -13189,6 +13267,9 @@ function useTableRowResize({
13189
13267
  pendingHeight: startHeight
13190
13268
  };
13191
13269
  showRowGuide(table, row, cell, startHeight);
13270
+ isRowResizingGlobal.active = true;
13271
+ window.getSelection()?.removeAllRanges();
13272
+ document.body.style.userSelect = "none";
13192
13273
  document.body.style.cursor = "row-resize";
13193
13274
  event.preventDefault();
13194
13275
  event.stopPropagation();
@@ -13230,6 +13311,8 @@ function useTableRowResize({
13230
13311
  editor.view.dispatch(tr);
13231
13312
  }
13232
13313
  stateRef.current = null;
13314
+ isRowResizingGlobal.active = false;
13315
+ document.body.style.userSelect = "";
13233
13316
  document.body.style.cursor = "";
13234
13317
  clearHoveredTableCell();
13235
13318
  clearAllTableResizeHover();
@@ -13238,6 +13321,8 @@ function useTableRowResize({
13238
13321
  const cancelResize = React11.useCallback(() => {
13239
13322
  if (!stateRef.current) return;
13240
13323
  stateRef.current = null;
13324
+ isRowResizingGlobal.active = false;
13325
+ document.body.style.userSelect = "";
13241
13326
  document.body.style.cursor = "";
13242
13327
  clearHoveredTableCell();
13243
13328
  clearAllTableResizeHover();
@@ -13245,6 +13330,8 @@ function useTableRowResize({
13245
13330
  }, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
13246
13331
  const cleanup = React11.useCallback(() => {
13247
13332
  stateRef.current = null;
13333
+ isRowResizingGlobal.active = false;
13334
+ document.body.style.userSelect = "";
13248
13335
  document.body.style.cursor = "";
13249
13336
  }, []);
13250
13337
  return {
@@ -13293,11 +13380,21 @@ function useUEditorTableInteractions(editor, editable = true) {
13293
13380
  guide.style.opacity = "0";
13294
13381
  }
13295
13382
  }, [getProseMirrorElement]);
13383
+ const hotspotTimerRef = useRef6(null);
13384
+ const activeHotspotKeyRef = useRef6(null);
13385
+ const clearHotspotTimer = React12.useCallback(() => {
13386
+ if (hotspotTimerRef.current !== null) {
13387
+ window.clearTimeout(hotspotTimerRef.current);
13388
+ hotspotTimerRef.current = null;
13389
+ }
13390
+ }, []);
13296
13391
  const clearAllTableResizeHover = React12.useCallback(() => {
13392
+ clearHotspotTimer();
13393
+ activeHotspotKeyRef.current = null;
13297
13394
  setEditorResizeCursor("");
13298
13395
  hideColumnGuide();
13299
13396
  hideRowGuide();
13300
- }, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
13397
+ }, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
13301
13398
  const updateActiveCellHighlight = React12.useCallback((cell) => {
13302
13399
  const surface = editorContentRef.current;
13303
13400
  const highlight = activeTableCellHighlightRef.current;
@@ -13436,6 +13533,10 @@ function useUEditorTableInteractions(editor, editable = true) {
13436
13533
  if (syncActiveRowResizeGuide()) {
13437
13534
  return;
13438
13535
  }
13536
+ if (event.buttons !== 0) {
13537
+ clearAllTableResizeHover();
13538
+ return;
13539
+ }
13439
13540
  const target = resolveEventElement(event.target);
13440
13541
  if (!(target instanceof Element)) {
13441
13542
  clearAllTableResizeHover();
@@ -13455,18 +13556,46 @@ function useUEditorTableInteractions(editor, editable = true) {
13455
13556
  clearAllTableResizeHover();
13456
13557
  return;
13457
13558
  }
13458
- const nearBottom = isRowResizeHotspot(cell, event.clientX, event.clientY);
13459
- const nearRight = isColumnResizeHotspot(cell, event.clientX, event.clientY);
13460
- if (nearBottom && cell instanceof HTMLTableCellElement) {
13461
- hideColumnGuide();
13462
- showRowGuide(table, row, cell);
13559
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
13560
+ const colTarget = resolveColumnResizeTarget(cell, event.clientX, event.clientY);
13561
+ if (rowTarget) {
13562
+ const hotspotKey = `row:${rowTarget.row.rowIndex}-${rowTarget.cell.cellIndex}`;
13563
+ if (activeHotspotKeyRef.current === hotspotKey) {
13564
+ hideColumnGuide();
13565
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
13566
+ return;
13567
+ }
13568
+ if (activeHotspotKeyRef.current !== hotspotKey) {
13569
+ clearHotspotTimer();
13570
+ activeHotspotKeyRef.current = hotspotKey;
13571
+ hotspotTimerRef.current = window.setTimeout(() => {
13572
+ hotspotTimerRef.current = null;
13573
+ hideColumnGuide();
13574
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
13575
+ }, 100);
13576
+ }
13463
13577
  return;
13464
13578
  }
13465
- if (nearRight && cell instanceof HTMLTableCellElement) {
13466
- hideRowGuide();
13467
- showColumnGuide(table, row, cell);
13579
+ if (colTarget) {
13580
+ const hotspotKey = `col:${colTarget.row.rowIndex}-${colTarget.cell.cellIndex}`;
13581
+ if (activeHotspotKeyRef.current === hotspotKey) {
13582
+ hideRowGuide();
13583
+ showColumnGuide(table, colTarget.row, colTarget.cell);
13584
+ return;
13585
+ }
13586
+ if (activeHotspotKeyRef.current !== hotspotKey) {
13587
+ clearHotspotTimer();
13588
+ activeHotspotKeyRef.current = hotspotKey;
13589
+ hotspotTimerRef.current = window.setTimeout(() => {
13590
+ hotspotTimerRef.current = null;
13591
+ hideRowGuide();
13592
+ showColumnGuide(table, colTarget.row, colTarget.cell);
13593
+ }, 100);
13594
+ }
13468
13595
  return;
13469
13596
  }
13597
+ clearHotspotTimer();
13598
+ activeHotspotKeyRef.current = null;
13470
13599
  clearAllTableResizeHover();
13471
13600
  };
13472
13601
  const handleEditorMouseLeave = () => {
@@ -13487,15 +13616,22 @@ function useUEditorTableInteractions(editor, editable = true) {
13487
13616
  clearActiveTableCell();
13488
13617
  return;
13489
13618
  }
13490
- setActiveTableCell(cell);
13491
- scheduleActiveCellSync(cell);
13492
13619
  const row = cell.closest("tr");
13493
13620
  const table = cell.closest("table");
13494
13621
  if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
13495
- if (beginResize(event, table, row, cell)) {
13496
- suppressActiveCellHighlightRef.current = true;
13497
- updateActiveCellHighlight(null);
13622
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
13623
+ if (rowTarget) {
13624
+ event.preventDefault();
13625
+ event.stopPropagation();
13626
+ window.getSelection()?.removeAllRanges();
13627
+ if (beginResize(event, table, rowTarget.row, rowTarget.cell)) {
13628
+ suppressActiveCellHighlightRef.current = true;
13629
+ updateActiveCellHighlight(null);
13630
+ return;
13631
+ }
13498
13632
  }
13633
+ setActiveTableCell(cell);
13634
+ scheduleActiveCellSync(cell);
13499
13635
  };
13500
13636
  const handlePointerMove = (event) => {
13501
13637
  handleRowResizePointerMove(event);
@@ -13584,8 +13720,9 @@ function useUEditorTableInteractions(editor, editable = true) {
13584
13720
  clearActiveTableCell();
13585
13721
  clearHoveredTableCell();
13586
13722
  clearAllTableResizeHover();
13723
+ clearHotspotTimer();
13587
13724
  };
13588
- }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
13725
+ }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHotspotTimer, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
13589
13726
  return {
13590
13727
  editorContentRef,
13591
13728
  tableColumnGuideRef,
@@ -14308,7 +14445,7 @@ function useUEditorOutput({
14308
14445
  // src/components/UEditor/UEditor.tsx
14309
14446
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
14310
14447
  var LazyMenuBar = React15.lazy(async () => {
14311
- const { MenuBar } = await import("./menu-bar-JSXW6AXW.js");
14448
+ const { MenuBar } = await import("./menu-bar-55SAOAX6.js");
14312
14449
  return { default: MenuBar };
14313
14450
  });
14314
14451
  var UEditor = React15.forwardRef(({
@@ -14339,6 +14476,7 @@ var UEditor = React15.forwardRef(({
14339
14476
  variant = "default",
14340
14477
  rounded = true,
14341
14478
  fontFamilies,
14479
+ defaultFontFamily = "Inter",
14342
14480
  fontSizes,
14343
14481
  lineHeights,
14344
14482
  letterSpacings,
@@ -14363,6 +14501,10 @@ var UEditor = React15.forwardRef(({
14363
14501
  const formulaRangePickRef = useRef10(null);
14364
14502
  const formulaRangeSurfaceRef = useRef10(null);
14365
14503
  const [formulaRangeHighlight, setFormulaRangeHighlight] = React15.useState(null);
14504
+ const [isMenuBarVisible, setIsMenuBarVisible] = React15.useState(showMenuBar);
14505
+ useEffect10(() => {
14506
+ setIsMenuBarVisible(showMenuBar);
14507
+ }, [showMenuBar]);
14366
14508
  const { flushOutputUpdates, scheduleOutputUpdate } = useUEditorOutput({
14367
14509
  onChange,
14368
14510
  onHtmlChange,
@@ -14621,7 +14763,7 @@ var UEditor = React15.forwardRef(({
14621
14763
  ),
14622
14764
  children: [
14623
14765
  editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ jsxs17(EditorUiRenderStateProvider, { editor, children: [
14624
- showMenuBar && /* @__PURE__ */ jsx20(React15.Suspense, { fallback: null, children: /* @__PURE__ */ jsx20(
14766
+ isMenuBarVisible && /* @__PURE__ */ jsx20(React15.Suspense, { fallback: null, children: /* @__PURE__ */ jsx20(
14625
14767
  LazyMenuBar,
14626
14768
  {
14627
14769
  editor,
@@ -14642,11 +14784,14 @@ var UEditor = React15.forwardRef(({
14642
14784
  {
14643
14785
  editor,
14644
14786
  variant,
14787
+ isMenuBarVisible,
14788
+ onToggleMenuBar: () => setIsMenuBarVisible((visible) => !visible),
14645
14789
  uploadImage,
14646
14790
  imageInsertMode,
14647
14791
  maxImageFileSize,
14648
14792
  allowedImageMimeTypes,
14649
14793
  fontFamilies,
14794
+ defaultFontFamily,
14650
14795
  fontSizes,
14651
14796
  lineHeights,
14652
14797
  letterSpacings
@@ -14672,6 +14817,7 @@ var UEditor = React15.forwardRef(({
14672
14817
  },
14673
14818
  className: "relative flex-1 overflow-y-auto",
14674
14819
  style: {
14820
+ fontFamily: defaultFontFamily,
14675
14821
  minHeight: editable ? minHeight : void 0,
14676
14822
  maxHeight
14677
14823
  },
@@ -14681,7 +14827,7 @@ var UEditor = React15.forwardRef(({
14681
14827
  {
14682
14828
  ref: tableColumnGuideRef,
14683
14829
  "aria-hidden": "true",
14684
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
14830
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
14685
14831
  }
14686
14832
  ),
14687
14833
  /* @__PURE__ */ jsx20(
@@ -14689,7 +14835,7 @@ var UEditor = React15.forwardRef(({
14689
14835
  {
14690
14836
  ref: tableRowGuideRef,
14691
14837
  "aria-hidden": "true",
14692
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
14838
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
14693
14839
  }
14694
14840
  ),
14695
14841
  /* @__PURE__ */ jsx20(
@@ -14698,7 +14844,7 @@ var UEditor = React15.forwardRef(({
14698
14844
  ref: activeTableCellHighlightRef,
14699
14845
  "aria-hidden": "true",
14700
14846
  "data-ueditor-active-cell-highlight": "",
14701
- className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
14847
+ className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
14702
14848
  }
14703
14849
  ),
14704
14850
  /* @__PURE__ */ jsx20(
@@ -14760,4 +14906,4 @@ export {
14760
14906
  prepareUEditorContentForSave,
14761
14907
  UEditor_default
14762
14908
  };
14763
- //# sourceMappingURL=chunk-P2RLTURA.js.map
14909
+ //# sourceMappingURL=chunk-PDYEK7HL.js.map