@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
package/dist/ueditor.cjs CHANGED
@@ -223,7 +223,9 @@ var init_en = __esm({
223
223
  imageWidthMd: "Image Width Medium",
224
224
  imageWidthLg: "Image Width Large",
225
225
  imageResetSize: "Reset Image Size",
226
- imageDelete: "Delete Image"
226
+ imageDelete: "Delete Image",
227
+ hideMenuBar: "Hide menu bar",
228
+ showMenuBar: "Show menu bar"
227
229
  },
228
230
  slashCommand: {
229
231
  basicBlocks: "Basic Blocks",
@@ -681,7 +683,9 @@ var init_vi = __esm({
681
683
  imageWidthMd: "\u1EA2nh V\u1EEBa",
682
684
  imageWidthLg: "\u1EA2nh L\u1EDBn",
683
685
  imageResetSize: "\u0110\u1EB7t L\u1EA1i K\xEDch Th\u01B0\u1EDBc \u1EA2nh",
684
- imageDelete: "X\xF3a \u1EA2nh"
686
+ imageDelete: "X\xF3a \u1EA2nh",
687
+ hideMenuBar: "\u1EA8n thanh menu",
688
+ showMenuBar: "Hi\u1EC7n thanh menu"
685
689
  },
686
690
  slashCommand: {
687
691
  basicBlocks: "Kh\u1ED1i c\u01A1 b\u1EA3n",
@@ -1139,7 +1143,9 @@ var init_ko = __esm({
1139
1143
  imageWidthMd: "\uC911\uAC04 \uC774\uBBF8\uC9C0",
1140
1144
  imageWidthLg: "\uD070 \uC774\uBBF8\uC9C0",
1141
1145
  imageResetSize: "\uC774\uBBF8\uC9C0 \uD06C\uAE30 \uCD08\uAE30\uD654",
1142
- imageDelete: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C"
1146
+ imageDelete: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C",
1147
+ hideMenuBar: "\uBA54\uB274 \uBAA8\uC74C \uC228\uAE30\uAE30",
1148
+ showMenuBar: "\uBA54\uB274 \uBAA8\uC74C \uD45C\uC2DC"
1143
1149
  },
1144
1150
  slashCommand: {
1145
1151
  basicBlocks: "\uAE30\uBCF8 \uBE14\uB85D",
@@ -1597,7 +1603,9 @@ var init_ja = __esm({
1597
1603
  imageWidthMd: "\u753B\u50CF\uFF08\u4E2D\uFF09",
1598
1604
  imageWidthLg: "\u753B\u50CF\uFF08\u5927\uFF09",
1599
1605
  imageResetSize: "\u753B\u50CF\u30B5\u30A4\u30BA\u3092\u30EA\u30BB\u30C3\u30C8",
1600
- imageDelete: "\u753B\u50CF\u3092\u524A\u9664"
1606
+ imageDelete: "\u753B\u50CF\u3092\u524A\u9664",
1607
+ hideMenuBar: "\u30E1\u30CB\u30E5\u30FC\u30D0\u30FC\u3092\u975E\u8868\u793A",
1608
+ showMenuBar: "\u30E1\u30CB\u30E5\u30FC\u30D0\u30FC\u3092\u8868\u793A"
1601
1609
  },
1602
1610
  slashCommand: {
1603
1611
  basicBlocks: "\u57FA\u672C\u30D6\u30ED\u30C3\u30AF",
@@ -5061,17 +5069,60 @@ function getSelectionTableCell(view) {
5061
5069
  const cell = element?.closest?.("th,td");
5062
5070
  return cell instanceof HTMLElement ? cell : null;
5063
5071
  }
5064
- function isRowResizeHotspot(cell, clientX, clientY) {
5072
+ function resolveRowResizeTarget(cell, clientX, clientY) {
5065
5073
  const rect = cell.getBoundingClientRect();
5066
- const nearBottom = rect.bottom - clientY <= TABLE_RESIZE_HIT_ZONE;
5067
- const nearRight = rect.right - clientX <= TABLE_RESIZE_HIT_ZONE;
5068
- return nearBottom && !nearRight;
5074
+ const row = cell.closest("tr");
5075
+ if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
5076
+ return null;
5077
+ }
5078
+ const distToBottom = Math.abs(clientY - rect.bottom);
5079
+ const distToTop = Math.abs(clientY - rect.top);
5080
+ const distToRight = Math.abs(clientX - rect.right);
5081
+ const distToLeft = Math.abs(clientX - rect.left);
5082
+ if (distToRight <= 3 || distToLeft <= 3) {
5083
+ return null;
5084
+ }
5085
+ if (distToBottom <= TABLE_RESIZE_HIT_ZONE) {
5086
+ return { row, cell };
5087
+ }
5088
+ if (distToTop <= TABLE_RESIZE_HIT_ZONE) {
5089
+ const prevRow = row.previousElementSibling;
5090
+ if (prevRow instanceof HTMLTableRowElement) {
5091
+ const cellIndex = cell.cellIndex;
5092
+ const prevCell = prevRow.children[cellIndex] ?? prevRow.firstElementChild;
5093
+ if (prevCell instanceof HTMLTableCellElement) {
5094
+ return { row: prevRow, cell: prevCell };
5095
+ }
5096
+ }
5097
+ }
5098
+ return null;
5069
5099
  }
5070
- function isColumnResizeHotspot(cell, clientX, clientY) {
5100
+ function resolveColumnResizeTarget(cell, clientX, clientY) {
5071
5101
  const rect = cell.getBoundingClientRect();
5072
- const nearRight = rect.right - clientX <= TABLE_RESIZE_HIT_ZONE;
5073
- const nearBottom = rect.bottom - clientY <= TABLE_RESIZE_HIT_ZONE;
5074
- return nearRight && !nearBottom;
5102
+ const row = cell.closest("tr");
5103
+ if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
5104
+ return null;
5105
+ }
5106
+ const distToRight = Math.abs(clientX - rect.right);
5107
+ const distToLeft = Math.abs(clientX - rect.left);
5108
+ const distToBottom = Math.abs(clientY - rect.bottom);
5109
+ const distToTop = Math.abs(clientY - rect.top);
5110
+ if (distToBottom <= 3 || distToTop <= 3) {
5111
+ return null;
5112
+ }
5113
+ if (distToRight <= TABLE_RESIZE_HIT_ZONE) {
5114
+ return { row, cell };
5115
+ }
5116
+ if (distToLeft <= TABLE_RESIZE_HIT_ZONE) {
5117
+ const prevCell = cell.previousElementSibling;
5118
+ if (prevCell instanceof HTMLTableCellElement) {
5119
+ return { row, cell: prevCell };
5120
+ }
5121
+ }
5122
+ return null;
5123
+ }
5124
+ function isRowResizeHotspot(cell, clientX, clientY) {
5125
+ return resolveRowResizeTarget(cell, clientX, clientY) !== null;
5075
5126
  }
5076
5127
  function getRelativeBoundaryMetrics(surface, table, row, cell) {
5077
5128
  const surfaceRect = surface.getBoundingClientRect();
@@ -5123,7 +5174,7 @@ function getRelativeSelectedCellsMetrics(surface) {
5123
5174
  height: bottom - top
5124
5175
  };
5125
5176
  }
5126
- var DEFAULT_TABLE_ROW_HEIGHT, MIN_TABLE_ROW_HEIGHT, COLUMN_RESIZE_LINE_THICKNESS, ROW_RESIZE_LINE_THICKNESS, UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, TABLE_RESIZE_HIT_ZONE;
5177
+ var DEFAULT_TABLE_ROW_HEIGHT, MIN_TABLE_ROW_HEIGHT, COLUMN_RESIZE_LINE_THICKNESS, ROW_RESIZE_LINE_THICKNESS, UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, isRowResizingGlobal, TABLE_RESIZE_HIT_ZONE;
5127
5178
  var init_table_dom_utils = __esm({
5128
5179
  "src/components/UEditor/table-dom-utils.ts"() {
5129
5180
  "use strict";
@@ -5131,8 +5182,9 @@ var init_table_dom_utils = __esm({
5131
5182
  MIN_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
5132
5183
  COLUMN_RESIZE_LINE_THICKNESS = 2;
5133
5184
  ROW_RESIZE_LINE_THICKNESS = 2;
5134
- UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor-table-layout-change";
5135
- TABLE_RESIZE_HIT_ZONE = 10;
5185
+ UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor:table-layout-change";
5186
+ isRowResizingGlobal = { active: false };
5187
+ TABLE_RESIZE_HIT_ZONE = 5;
5136
5188
  }
5137
5189
  });
5138
5190
 
@@ -6211,6 +6263,18 @@ var init_colors = __esm({
6211
6263
  const automaticColor = colors[0]?.color ?? "";
6212
6264
  const paletteColors = colors.slice(1);
6213
6265
  const customColorSelect = onCustomColorSelect ?? onSelect;
6266
+ const [hexInput, setHexInput] = import_react31.default.useState(currentColor.startsWith("#") ? currentColor : "");
6267
+ import_react31.default.useEffect(() => {
6268
+ setHexInput(currentColor.startsWith("#") ? currentColor : "");
6269
+ }, [currentColor]);
6270
+ const commitHex = (val) => {
6271
+ let formatted = val.trim();
6272
+ if (!formatted) return;
6273
+ if (!formatted.startsWith("#")) formatted = `#${formatted}`;
6274
+ if (/^#([0-9A-F]{3}){1,2}$/i.test(formatted)) {
6275
+ customColorSelect(formatted);
6276
+ }
6277
+ };
6214
6278
  import_react31.default.useEffect(() => {
6215
6279
  const input = colorInputRef.current;
6216
6280
  if (!input) return;
@@ -6222,7 +6286,7 @@ var init_colors = __esm({
6222
6286
  const input = colorInputRef.current;
6223
6287
  if (input) input.value = currentColor.startsWith("#") ? currentColor : "#000000";
6224
6288
  }, [currentColor]);
6225
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-56 p-2", children: [
6289
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-56 p-2", "data-ueditor-keep-open": true, children: [
6226
6290
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
6227
6291
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6228
6292
  "button",
@@ -6256,29 +6320,48 @@ var init_colors = __esm({
6256
6320
  children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Check, { className: cn("h-3.5 w-3.5", getSwatchCheckClass(c.color)) }) })
6257
6321
  }
6258
6322
  ) }, `${c.name}-${c.color}`)) }),
6259
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6260
- "button",
6261
- {
6262
- type: "button",
6263
- onMouseDown: (e) => e.preventDefault(),
6264
- onClick: () => colorInputRef.current?.click(),
6265
- className: "mt-3 flex h-9 w-full items-center gap-3 rounded-md px-2 text-sm text-foreground transition-colors hover:bg-muted",
6266
- children: [
6267
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6268
- "span",
6269
- {
6270
- "aria-hidden": "true",
6271
- className: "h-5 w-5 rounded border border-border",
6272
- style: {
6273
- background: "linear-gradient(135deg, #ff004c 0%, #fffb00 22%, #00ff66 42%, #00d5ff 62%, #2446ff 78%, #ff00d4 100%)"
6323
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
6324
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex h-8 flex-1 items-center gap-1.5 rounded-md border border-input bg-muted/30 px-2", children: [
6325
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6326
+ "span",
6327
+ {
6328
+ className: "h-4 w-4 shrink-0 rounded-[2px] border border-border",
6329
+ style: { backgroundColor: hexInput.startsWith("#") ? hexInput : currentColor.startsWith("#") ? currentColor : "transparent" }
6330
+ }
6331
+ ),
6332
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6333
+ "input",
6334
+ {
6335
+ type: "text",
6336
+ value: hexInput,
6337
+ onChange: (e) => setHexInput(e.target.value),
6338
+ onBlur: () => commitHex(hexInput),
6339
+ onMouseDown: (e) => e.stopPropagation(),
6340
+ onClick: (e) => e.stopPropagation(),
6341
+ onKeyDown: (e) => {
6342
+ e.stopPropagation();
6343
+ if (e.key === "Enter") {
6344
+ e.preventDefault();
6345
+ commitHex(hexInput);
6274
6346
  }
6275
- }
6276
- ),
6277
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
6278
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Palette, { className: "h-4 w-4 text-muted-foreground" })
6279
- ]
6280
- }
6281
- ),
6347
+ },
6348
+ placeholder: "#HEX",
6349
+ className: "h-full w-full bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground"
6350
+ }
6351
+ )
6352
+ ] }),
6353
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6354
+ "button",
6355
+ {
6356
+ type: "button",
6357
+ onMouseDown: (e) => e.stopPropagation(),
6358
+ onClick: () => colorInputRef.current?.click(),
6359
+ title: t("colors.moreColors"),
6360
+ className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-input bg-muted/30 text-foreground transition-colors hover:bg-muted",
6361
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Palette, { className: "h-4 w-4 text-muted-foreground" })
6362
+ }
6363
+ )
6364
+ ] }),
6282
6365
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6283
6366
  "input",
6284
6367
  {
@@ -6852,7 +6935,7 @@ var init_toolbar = __esm({
6852
6935
  return button;
6853
6936
  });
6854
6937
  ToolbarButton.displayName = "ToolbarButton";
6855
- ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-hidden": "true", className: "mx-1.5 h-7 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
6938
+ ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-hidden": "true", className: "mx-1 h-5 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
6856
6939
  TableInsertGrid = ({
6857
6940
  insertLabel,
6858
6941
  previewTemplate,
@@ -6892,11 +6975,14 @@ var init_toolbar = __esm({
6892
6975
  EditorToolbar = ({
6893
6976
  editor,
6894
6977
  variant,
6978
+ isMenuBarVisible,
6979
+ onToggleMenuBar,
6895
6980
  uploadImage,
6896
6981
  imageInsertMode = "base64",
6897
6982
  maxImageFileSize = DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
6898
6983
  allowedImageMimeTypes = DEFAULT_UEDITOR_IMAGE_MIME_TYPES,
6899
6984
  fontFamilies,
6985
+ defaultFontFamily = "Inter",
6900
6986
  fontSizes,
6901
6987
  lineHeights,
6902
6988
  letterSpacings
@@ -6939,9 +7025,9 @@ var init_toolbar = __esm({
6939
7025
  const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
6940
7026
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
6941
7027
  const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
6942
- const defaultFontFamily = availableFontFamilies[0];
6943
- const defaultFontFamilyValue = defaultFontFamily?.value ?? "";
6944
- const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel : defaultFontFamily?.label ?? t("toolbar.fontDefault");
7028
+ const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
7029
+ const defaultFontFamilyValue = defaultFontFamilyOption?.value ?? defaultFontFamily ?? "Inter";
7030
+ const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel : defaultFontFamilyOption?.label ?? defaultFontFamily ?? t("toolbar.fontDefault");
6945
7031
  const displayedFontFamilyValue = currentFontFamily || defaultFontFamilyValue;
6946
7032
  const displayedFontSizeLabel = currentFontSize ? currentFontSizeLabel : "13";
6947
7033
  const activeFontSize = currentFontSize || "13px";
@@ -7065,6 +7151,15 @@ var init_toolbar = __esm({
7065
7151
  )
7066
7152
  ] })
7067
7153
  }
7154
+ ),
7155
+ onToggleMenuBar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7156
+ ToolbarButton,
7157
+ {
7158
+ onClick: onToggleMenuBar,
7159
+ active: isMenuBarVisible,
7160
+ title: t(isMenuBarVisible ? "toolbar.hideMenuBar" : "toolbar.showMenuBar"),
7161
+ children: isMenuBarVisible ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.PanelTopClose, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.PanelTopOpen, { className: "h-4 w-4" })
7162
+ }
7068
7163
  )
7069
7164
  ] });
7070
7165
  }
@@ -7073,7 +7168,7 @@ var init_toolbar = __esm({
7073
7168
  "div",
7074
7169
  {
7075
7170
  role: "toolbar",
7076
- className: "flex min-h-12 flex-nowrap items-center gap-0.5 overflow-x-auto border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-2 py-2 dark:bg-muted/60",
7171
+ className: "flex min-h-9 flex-wrap items-center gap-0.5 border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-1.5 py-1 dark:bg-muted/60",
7077
7172
  children: [
7078
7173
  isFull && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7079
7174
  DropdownMenu,
@@ -7084,9 +7179,9 @@ var init_toolbar = __esm({
7084
7179
  onClick: () => {
7085
7180
  },
7086
7181
  title: t("toolbar.fontFamily"),
7087
- className: "h-8 w-44 max-w-44 justify-between gap-2 border border-[rgba(196,197,213,0.6)] bg-white px-2.5 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
7182
+ className: "h-7 w-40 max-w-40 justify-between gap-1.5 border border-[rgba(196,197,213,0.6)] bg-white px-2 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
7088
7183
  children: [
7089
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
7184
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-xs font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
7090
7185
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7091
7186
  ]
7092
7187
  }
@@ -7113,9 +7208,9 @@ var init_toolbar = __esm({
7113
7208
  onClick: () => {
7114
7209
  },
7115
7210
  title: t("toolbar.fontSize"),
7116
- className: "h-8 w-16 justify-between gap-2 border border-[rgba(196,197,213,0.6)] bg-white px-2.5 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
7211
+ className: "h-7 w-14 justify-between gap-1 border border-[rgba(196,197,213,0.6)] bg-white px-2 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
7117
7212
  children: [
7118
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-sm font-normal leading-none", children: displayedFontSizeLabel }),
7213
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
7119
7214
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7120
7215
  ]
7121
7216
  }
@@ -7240,6 +7335,27 @@ var init_toolbar = __esm({
7240
7335
  )
7241
7336
  ] }),
7242
7337
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarDivider, {}),
7338
+ (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7339
+ DropdownMenu,
7340
+ {
7341
+ isOpen: isTableMenuOpen,
7342
+ onOpenChange: setIsTableMenuOpen,
7343
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => {
7344
+ }, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
7345
+ contentClassName: "p-2 min-w-56",
7346
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7347
+ TableInsertGrid,
7348
+ {
7349
+ insertLabel: t("tableMenu.insertTable"),
7350
+ previewTemplate: t("tableMenu.gridPreview"),
7351
+ onInsert: (rows, cols) => {
7352
+ editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
7353
+ setIsTableMenuOpen(false);
7354
+ }
7355
+ }
7356
+ )
7357
+ }
7358
+ ),
7243
7359
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaBoldIcon, { className: "h-4 w-4" }) }),
7244
7360
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaItalicIcon, { className: "h-4 w-4" }) }),
7245
7361
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -7710,27 +7826,6 @@ var init_toolbar = __esm({
7710
7826
  ] })
7711
7827
  }
7712
7828
  ),
7713
- (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7714
- DropdownMenu,
7715
- {
7716
- isOpen: isTableMenuOpen,
7717
- onOpenChange: setIsTableMenuOpen,
7718
- trigger: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => {
7719
- }, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
7720
- contentClassName: "p-2 min-w-56",
7721
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7722
- TableInsertGrid,
7723
- {
7724
- insertLabel: t("tableMenu.insertTable"),
7725
- previewTemplate: t("tableMenu.gridPreview"),
7726
- onInsert: (rows, cols) => {
7727
- editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
7728
- setIsTableMenuOpen(false);
7729
- }
7730
- }
7731
- )
7732
- }
7733
- ),
7734
7829
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarDivider, {}),
7735
7830
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaUndoIcon, { className: "h-4 w-4" }) }),
7736
7831
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaRedoIcon, { className: "h-4 w-4" }) }),
@@ -7788,7 +7883,16 @@ var init_toolbar = __esm({
7788
7883
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.TableCellsMerge, { className: "w-4 h-4" })
7789
7884
  }
7790
7885
  )
7791
- ] })
7886
+ ] }),
7887
+ onToggleMenuBar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7888
+ ToolbarButton,
7889
+ {
7890
+ onClick: onToggleMenuBar,
7891
+ active: isMenuBarVisible,
7892
+ title: t(isMenuBarVisible ? "toolbar.hideMenuBar" : "toolbar.showMenuBar"),
7893
+ children: isMenuBarVisible ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.PanelTopClose, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.PanelTopOpen, { className: "h-4 w-4" })
7894
+ }
7895
+ )
7792
7896
  ]
7793
7897
  }
7794
7898
  );
@@ -7929,7 +8033,7 @@ var init_editor_styles = __esm({
7929
8033
  "[&_.selectedCell]:after:absolute",
7930
8034
  "[&_.selectedCell]:after:inset-0",
7931
8035
  "[&_.selectedCell]:after:z-[2]",
7932
- "[&_.selectedCell]:after:bg-primary/15",
8036
+ "[&_.selectedCell]:after:bg-primary/8",
7933
8037
  "[&_.selectedCell]:after:pointer-events-none",
7934
8038
  "[&_.column-resize-handle]:pointer-events-auto",
7935
8039
  "[&_.column-resize-handle]:cursor-col-resize",
@@ -7943,17 +8047,10 @@ var init_editor_styles = __esm({
7943
8047
  "[&_.column-resize-handle]:rounded-none",
7944
8048
  "[&_.column-resize-handle]:opacity-0",
7945
8049
  "[&_.column-resize-handle]:transition-opacity",
7946
- "[&_.column-resize-handle]:after:absolute",
7947
- "[&_.column-resize-handle]:after:top-0",
7948
- "[&_.column-resize-handle]:after:bottom-0",
7949
- "[&_.column-resize-handle]:after:left-1/2",
7950
- "[&_.column-resize-handle]:after:w-0.5",
7951
- "[&_.column-resize-handle]:after:-translate-x-1/2",
7952
- "[&_.column-resize-handle]:after:rounded-full",
7953
- "[&_.column-resize-handle]:after:bg-primary/75",
7954
- "[&_.column-resize-handle]:after:content-['']",
7955
- "[&.resize-cursor_.column-resize-handle]:opacity-100",
7956
- "[&.resize-cursor_.column-resize-handle]:after:bg-primary",
8050
+ "[&_.column-resize-handle]:duration-200",
8051
+ "[&_.column-resize-handle]:delay-100",
8052
+ "[&_.column-resize-handle]:ease-out",
8053
+ "[&_.column-resize-handle]:after:hidden",
7957
8054
  "[&_.column-resize-dragging]:min-w-0",
7958
8055
  "[&.resize-cursor]:cursor-col-resize",
7959
8056
  "[&.resize-row-cursor]:cursor-row-resize",
@@ -12116,6 +12213,15 @@ function edgeCell(view, event, side, handleWidth) {
12116
12213
  const index = map.map.indexOf($cell.pos - start);
12117
12214
  return index % map.width === 0 ? -1 : start + map.map[index - 1];
12118
12215
  }
12216
+ var handleHoverTimer = null;
12217
+ var pendingHandleCell = -1;
12218
+ function clearHandleHoverTimer() {
12219
+ if (handleHoverTimer !== null) {
12220
+ window.clearTimeout(handleHoverTimer);
12221
+ handleHoverTimer = null;
12222
+ }
12223
+ pendingHandleCell = -1;
12224
+ }
12119
12225
  function updateHandle(view, value) {
12120
12226
  view.dispatch(view.state.tr.setMeta(import_tables2.columnResizingPluginKey, { setHandle: value }));
12121
12227
  }
@@ -12130,19 +12236,43 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
12130
12236
  if (event.clientX - left <= handleWidth) cell = edgeCell(view, event, "left", handleWidth);
12131
12237
  else if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, "right", handleWidth);
12132
12238
  }
12133
- if (cell === pluginState.activeHandle) return;
12134
- if (!lastColumnResizable && cell !== -1) {
12239
+ if (cell === pluginState.activeHandle) {
12240
+ clearHandleHoverTimer();
12241
+ return;
12242
+ }
12243
+ if (cell === -1) {
12244
+ clearHandleHoverTimer();
12245
+ if (pluginState.activeHandle !== -1) {
12246
+ updateHandle(view, -1);
12247
+ }
12248
+ return;
12249
+ }
12250
+ if (!lastColumnResizable) {
12135
12251
  const $cell = view.state.doc.resolve(cell);
12136
12252
  const table = $cell.node(-1);
12137
12253
  const map = import_tables2.TableMap.get(table);
12138
12254
  const tableStart = $cell.start(-1);
12139
12255
  const nodeAfter = $cell.nodeAfter;
12140
12256
  if (!nodeAfter) return;
12141
- if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) return;
12257
+ if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) {
12258
+ clearHandleHoverTimer();
12259
+ if (pluginState.activeHandle !== -1) {
12260
+ updateHandle(view, -1);
12261
+ }
12262
+ return;
12263
+ }
12142
12264
  }
12143
- updateHandle(view, cell);
12265
+ if (pendingHandleCell === cell) return;
12266
+ clearHandleHoverTimer();
12267
+ pendingHandleCell = cell;
12268
+ handleHoverTimer = window.setTimeout(() => {
12269
+ handleHoverTimer = null;
12270
+ pendingHandleCell = -1;
12271
+ updateHandle(view, cell);
12272
+ }, 100);
12144
12273
  }
12145
12274
  function handleMouseLeave(view) {
12275
+ clearHandleHoverTimer();
12146
12276
  if (!view.editable) return;
12147
12277
  const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
12148
12278
  if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) {
@@ -12191,7 +12321,7 @@ function getColumnResizeGhost(view) {
12191
12321
  ghost.style.pointerEvents = "none";
12192
12322
  ghost.style.width = "2px";
12193
12323
  ghost.style.backgroundColor = "var(--primary, #2563eb)";
12194
- ghost.style.opacity = "1";
12324
+ ghost.style.opacity = "0.5";
12195
12325
  ghost.style.borderRadius = "9999px";
12196
12326
  ghost.style.boxShadow = "0 0 0 1px color-mix(in oklch, var(--background, #fff) 80%, transparent)";
12197
12327
  ghost.style.transform = "translateX(-1px)";
@@ -12220,6 +12350,7 @@ function showColumnResizeGhost(view, cell, dragging, width) {
12220
12350
  ghost.style.height = `${rect.height}px`;
12221
12351
  }
12222
12352
  function handleMouseDown(view, event, cellMinWidth) {
12353
+ clearHandleHoverTimer();
12223
12354
  if (!view.editable) return false;
12224
12355
  const win = view.dom.ownerDocument.defaultView ?? window;
12225
12356
  const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
@@ -12341,6 +12472,7 @@ function dynamicColumnResizing({
12341
12472
 
12342
12473
  // src/components/UEditor/table-align.ts
12343
12474
  init_table_align_utils();
12475
+ init_table_dom_utils();
12344
12476
  function normalizeTableAlign(value) {
12345
12477
  if (value === "left" || value === "center" || value === "right") {
12346
12478
  return value;
@@ -12467,6 +12599,38 @@ var UEditorTable = import_extension_table.Table.extend({
12467
12599
  lastColumnResizable: this.options.lastColumnResizable
12468
12600
  })
12469
12601
  ] : [],
12602
+ new import_state7.Plugin({
12603
+ key: new import_state7.PluginKey("tableRowResizeInterceptor"),
12604
+ props: {
12605
+ handleDOMEvents: {
12606
+ mousedown(view, event) {
12607
+ if (event.button !== 0) return false;
12608
+ const target = resolveEventElement(event.target);
12609
+ const cell = target?.closest("th,td");
12610
+ if (cell instanceof HTMLElement && isRowResizeHotspot(cell, event.clientX, event.clientY)) {
12611
+ isRowResizingGlobal.active = true;
12612
+ return true;
12613
+ }
12614
+ return false;
12615
+ },
12616
+ mousemove(_view, event) {
12617
+ if (isRowResizingGlobal.active) {
12618
+ if (event.buttons === 0) {
12619
+ isRowResizingGlobal.active = false;
12620
+ return false;
12621
+ }
12622
+ event.preventDefault();
12623
+ return true;
12624
+ }
12625
+ return false;
12626
+ },
12627
+ mouseup() {
12628
+ isRowResizingGlobal.active = false;
12629
+ return false;
12630
+ }
12631
+ }
12632
+ }
12633
+ }),
12470
12634
  (0, import_tables3.tableEditing)({
12471
12635
  allowTableNodeSelection: this.options.allowTableNodeSelection
12472
12636
  }),
@@ -15626,7 +15790,11 @@ var CustomBubbleMenu = ({
15626
15790
  setIsVisible(false);
15627
15791
  return;
15628
15792
  }
15629
- if (!keepOpenRef.current && (context2 === "none" || !view.hasFocus())) {
15793
+ const isInputFocused = () => {
15794
+ const active = document.activeElement;
15795
+ return Boolean(active && (menuRef.current?.contains(active) || active.closest?.("[data-ueditor-keep-open]")));
15796
+ };
15797
+ if (!keepOpenRef.current && !isInputFocused() && (context2 === "none" || !view.hasFocus())) {
15630
15798
  clearShowTimeout();
15631
15799
  setIsVisible(false);
15632
15800
  return;
@@ -15667,7 +15835,8 @@ var CustomBubbleMenu = ({
15667
15835
  }, SHOW_DELAY_MS);
15668
15836
  };
15669
15837
  const handleBlur = () => {
15670
- if (!keepOpenRef.current) {
15838
+ const isInputFocused = Boolean(document.activeElement && (menuRef.current?.contains(document.activeElement) || document.activeElement.closest?.("[data-ueditor-keep-open]")));
15839
+ if (!keepOpenRef.current && !isInputFocused) {
15671
15840
  clearShowTimeout();
15672
15841
  setIsVisible(false);
15673
15842
  }
@@ -15761,6 +15930,9 @@ var CustomBubbleMenu = ({
15761
15930
  } else if (target?.closest?.("[data-ueditor-keep-open]")) {
15762
15931
  setKeepOpen(true);
15763
15932
  }
15933
+ if (target && target.closest("input, textarea, select")) {
15934
+ return;
15935
+ }
15764
15936
  e.preventDefault();
15765
15937
  },
15766
15938
  children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -19334,7 +19506,7 @@ function createKey(name) {
19334
19506
  keys[name] = 0;
19335
19507
  return name + "$";
19336
19508
  }
19337
- var PluginKey6 = class {
19509
+ var PluginKey7 = class {
19338
19510
  /**
19339
19511
  Create a plugin key.
19340
19512
  */
@@ -19766,7 +19938,7 @@ function tableNodeTypes2(schema) {
19766
19938
  }
19767
19939
  return result;
19768
19940
  }
19769
- var tableEditingKey = new PluginKey6("selectingCells");
19941
+ var tableEditingKey = new PluginKey7("selectingCells");
19770
19942
  function cellAround2($pos) {
19771
19943
  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));
19772
19944
  return null;
@@ -19997,7 +20169,7 @@ var CellBookmark = class CellBookmark2 {
19997
20169
  else return Selection.near($headCell, 1);
19998
20170
  }
19999
20171
  };
20000
- var fixTablesKey = new PluginKey6("fix-tables");
20172
+ var fixTablesKey = new PluginKey7("fix-tables");
20001
20173
  function convertTableNodeToArrayOfRows(tableNode) {
20002
20174
  const map = TableMap4.get(tableNode);
20003
20175
  const rows = [];
@@ -20475,7 +20647,7 @@ function atEndOfCell(view, axis, dir) {
20475
20647
  }
20476
20648
  return null;
20477
20649
  }
20478
- var columnResizingPluginKey2 = new PluginKey6("tableColumnResizing");
20650
+ var columnResizingPluginKey2 = new PluginKey7("tableColumnResizing");
20479
20651
 
20480
20652
  // src/components/UEditor/table-controls.tsx
20481
20653
  var import_lucide_react18 = require("lucide-react");
@@ -20924,6 +21096,8 @@ init_Tooltip();
20924
21096
  var import_jsx_runtime29 = require("react/jsx-runtime");
20925
21097
  var ADD_COLUMN_RAIL_GAP = 4;
20926
21098
  var ADD_ROW_RAIL_GAP = 4;
21099
+ var BUTTON_LONG_SIZE = 36;
21100
+ var BUTTON_SHORT_SIZE = 14;
20927
21101
  function TableAddRails({
20928
21102
  addColumnVisible,
20929
21103
  addRowVisible,
@@ -20936,10 +21110,10 @@ function TableAddRails({
20936
21110
  quickAddRowLabel
20937
21111
  }) {
20938
21112
  const visibleBounds = getVisibleTableBounds(layout);
20939
- const columnRailTop = visibleBounds.top;
21113
+ const columnRailTop = visibleBounds.top + Math.max(0, (visibleBounds.height - BUTTON_LONG_SIZE) / 2);
20940
21114
  const columnRailLeft = visibleBounds.right + ADD_COLUMN_RAIL_GAP;
20941
21115
  const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
20942
- const rowRailLeft = visibleBounds.left;
21116
+ const rowRailLeft = visibleBounds.left + Math.max(0, (visibleBounds.width - BUTTON_LONG_SIZE) / 2);
20943
21117
  const showColumnRail = controlsVisible || addColumnVisible;
20944
21118
  const showRowRail = controlsVisible || addRowVisible;
20945
21119
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
@@ -20964,15 +21138,15 @@ function TableAddRails({
20964
21138
  className: cn(
20965
21139
  "absolute z-30 inline-flex items-center justify-center rounded-md",
20966
21140
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
20967
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
21141
+ "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"
20968
21142
  ),
20969
21143
  style: {
20970
- top: showColumnRail ? columnRailTop : columnRailTop + Math.max(0, visibleBounds.height / 2 - 24),
21144
+ top: columnRailTop,
20971
21145
  left: columnRailLeft,
20972
- width: showColumnRail ? 18 : 12,
20973
- height: showColumnRail ? visibleBounds.height : 48,
21146
+ width: BUTTON_SHORT_SIZE,
21147
+ height: BUTTON_LONG_SIZE,
20974
21148
  opacity: showColumnRail ? 1 : 0,
20975
- transform: showColumnRail ? "scale(1)" : "scale(0.92)",
21149
+ transform: showColumnRail ? "scale(1)" : "scale(0.85)",
20976
21150
  pointerEvents: showColumnRail ? "auto" : "none"
20977
21151
  },
20978
21152
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -21001,15 +21175,15 @@ function TableAddRails({
21001
21175
  className: cn(
21002
21176
  "absolute z-30 inline-flex items-center justify-center rounded-md",
21003
21177
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
21004
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
21178
+ "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"
21005
21179
  ),
21006
21180
  style: {
21007
21181
  top: rowRailTop,
21008
- left: showRowRail ? rowRailLeft : rowRailLeft + Math.max(0, visibleBounds.width / 2 - 24),
21009
- width: showRowRail ? visibleBounds.width : 48,
21010
- height: showRowRail ? 16 : 12,
21182
+ left: rowRailLeft,
21183
+ width: BUTTON_LONG_SIZE,
21184
+ height: BUTTON_SHORT_SIZE,
21011
21185
  opacity: showRowRail ? 1 : 0,
21012
- transform: showRowRail ? "scale(1)" : "scale(0.92)",
21186
+ transform: showRowRail ? "scale(1)" : "scale(0.85)",
21013
21187
  pointerEvents: showRowRail ? "auto" : "none"
21014
21188
  },
21015
21189
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -21146,7 +21320,7 @@ function TableRowHandles({
21146
21320
  onStartDrag(rowHandle);
21147
21321
  },
21148
21322
  className: cn(
21149
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
21323
+ "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",
21150
21324
  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"
21151
21325
  ),
21152
21326
  style: {
@@ -21221,7 +21395,7 @@ function TableColumnHandles({
21221
21395
  onStartDrag(columnHandle);
21222
21396
  },
21223
21397
  className: cn(
21224
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
21398
+ "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",
21225
21399
  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"
21226
21400
  ),
21227
21401
  style: {
@@ -21610,7 +21784,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
21610
21784
  const updateHoverState = import_react37.default.useCallback((event) => {
21611
21785
  const activeLayout = layoutRef.current;
21612
21786
  const surface = containerRef.current;
21613
- if (!activeLayout || !surface || dragStateRef.current) {
21787
+ if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
21614
21788
  setHoverState(DEFAULT_TABLE_HOVER_STATE);
21615
21789
  return;
21616
21790
  }
@@ -21744,7 +21918,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
21744
21918
  return result;
21745
21919
  }, [editor, scheduleSyncFromSelection]);
21746
21920
  const canExpandTable = Boolean(layout);
21747
- const controlsVisible = dragPreview !== null;
21921
+ const controlsVisible = false;
21748
21922
  const tableMenuOpen = openMenuKey === "table";
21749
21923
  const startTableResize = import_react37.default.useCallback((event) => {
21750
21924
  if (event.button !== 0 || dragStateRef.current) return;
@@ -22271,6 +22445,9 @@ function useTableRowResize({
22271
22445
  pendingHeight: startHeight
22272
22446
  };
22273
22447
  showRowGuide(table, row, cell, startHeight);
22448
+ isRowResizingGlobal.active = true;
22449
+ window.getSelection()?.removeAllRanges();
22450
+ document.body.style.userSelect = "none";
22274
22451
  document.body.style.cursor = "row-resize";
22275
22452
  event.preventDefault();
22276
22453
  event.stopPropagation();
@@ -22312,6 +22489,8 @@ function useTableRowResize({
22312
22489
  editor.view.dispatch(tr);
22313
22490
  }
22314
22491
  stateRef.current = null;
22492
+ isRowResizingGlobal.active = false;
22493
+ document.body.style.userSelect = "";
22315
22494
  document.body.style.cursor = "";
22316
22495
  clearHoveredTableCell();
22317
22496
  clearAllTableResizeHover();
@@ -22320,6 +22499,8 @@ function useTableRowResize({
22320
22499
  const cancelResize = import_react38.default.useCallback(() => {
22321
22500
  if (!stateRef.current) return;
22322
22501
  stateRef.current = null;
22502
+ isRowResizingGlobal.active = false;
22503
+ document.body.style.userSelect = "";
22323
22504
  document.body.style.cursor = "";
22324
22505
  clearHoveredTableCell();
22325
22506
  clearAllTableResizeHover();
@@ -22327,6 +22508,8 @@ function useTableRowResize({
22327
22508
  }, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
22328
22509
  const cleanup = import_react38.default.useCallback(() => {
22329
22510
  stateRef.current = null;
22511
+ isRowResizingGlobal.active = false;
22512
+ document.body.style.userSelect = "";
22330
22513
  document.body.style.cursor = "";
22331
22514
  }, []);
22332
22515
  return {
@@ -22375,11 +22558,21 @@ function useUEditorTableInteractions(editor, editable = true) {
22375
22558
  guide.style.opacity = "0";
22376
22559
  }
22377
22560
  }, [getProseMirrorElement]);
22561
+ const hotspotTimerRef = (0, import_react39.useRef)(null);
22562
+ const activeHotspotKeyRef = (0, import_react39.useRef)(null);
22563
+ const clearHotspotTimer = import_react39.default.useCallback(() => {
22564
+ if (hotspotTimerRef.current !== null) {
22565
+ window.clearTimeout(hotspotTimerRef.current);
22566
+ hotspotTimerRef.current = null;
22567
+ }
22568
+ }, []);
22378
22569
  const clearAllTableResizeHover = import_react39.default.useCallback(() => {
22570
+ clearHotspotTimer();
22571
+ activeHotspotKeyRef.current = null;
22379
22572
  setEditorResizeCursor("");
22380
22573
  hideColumnGuide();
22381
22574
  hideRowGuide();
22382
- }, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
22575
+ }, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
22383
22576
  const updateActiveCellHighlight = import_react39.default.useCallback((cell) => {
22384
22577
  const surface = editorContentRef.current;
22385
22578
  const highlight = activeTableCellHighlightRef.current;
@@ -22518,6 +22711,10 @@ function useUEditorTableInteractions(editor, editable = true) {
22518
22711
  if (syncActiveRowResizeGuide()) {
22519
22712
  return;
22520
22713
  }
22714
+ if (event.buttons !== 0) {
22715
+ clearAllTableResizeHover();
22716
+ return;
22717
+ }
22521
22718
  const target = resolveEventElement(event.target);
22522
22719
  if (!(target instanceof Element)) {
22523
22720
  clearAllTableResizeHover();
@@ -22537,18 +22734,46 @@ function useUEditorTableInteractions(editor, editable = true) {
22537
22734
  clearAllTableResizeHover();
22538
22735
  return;
22539
22736
  }
22540
- const nearBottom = isRowResizeHotspot(cell, event.clientX, event.clientY);
22541
- const nearRight = isColumnResizeHotspot(cell, event.clientX, event.clientY);
22542
- if (nearBottom && cell instanceof HTMLTableCellElement) {
22543
- hideColumnGuide();
22544
- showRowGuide(table, row, cell);
22737
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
22738
+ const colTarget = resolveColumnResizeTarget(cell, event.clientX, event.clientY);
22739
+ if (rowTarget) {
22740
+ const hotspotKey = `row:${rowTarget.row.rowIndex}-${rowTarget.cell.cellIndex}`;
22741
+ if (activeHotspotKeyRef.current === hotspotKey) {
22742
+ hideColumnGuide();
22743
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
22744
+ return;
22745
+ }
22746
+ if (activeHotspotKeyRef.current !== hotspotKey) {
22747
+ clearHotspotTimer();
22748
+ activeHotspotKeyRef.current = hotspotKey;
22749
+ hotspotTimerRef.current = window.setTimeout(() => {
22750
+ hotspotTimerRef.current = null;
22751
+ hideColumnGuide();
22752
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
22753
+ }, 100);
22754
+ }
22545
22755
  return;
22546
22756
  }
22547
- if (nearRight && cell instanceof HTMLTableCellElement) {
22548
- hideRowGuide();
22549
- showColumnGuide(table, row, cell);
22757
+ if (colTarget) {
22758
+ const hotspotKey = `col:${colTarget.row.rowIndex}-${colTarget.cell.cellIndex}`;
22759
+ if (activeHotspotKeyRef.current === hotspotKey) {
22760
+ hideRowGuide();
22761
+ showColumnGuide(table, colTarget.row, colTarget.cell);
22762
+ return;
22763
+ }
22764
+ if (activeHotspotKeyRef.current !== hotspotKey) {
22765
+ clearHotspotTimer();
22766
+ activeHotspotKeyRef.current = hotspotKey;
22767
+ hotspotTimerRef.current = window.setTimeout(() => {
22768
+ hotspotTimerRef.current = null;
22769
+ hideRowGuide();
22770
+ showColumnGuide(table, colTarget.row, colTarget.cell);
22771
+ }, 100);
22772
+ }
22550
22773
  return;
22551
22774
  }
22775
+ clearHotspotTimer();
22776
+ activeHotspotKeyRef.current = null;
22552
22777
  clearAllTableResizeHover();
22553
22778
  };
22554
22779
  const handleEditorMouseLeave = () => {
@@ -22569,15 +22794,22 @@ function useUEditorTableInteractions(editor, editable = true) {
22569
22794
  clearActiveTableCell();
22570
22795
  return;
22571
22796
  }
22572
- setActiveTableCell(cell);
22573
- scheduleActiveCellSync(cell);
22574
22797
  const row = cell.closest("tr");
22575
22798
  const table = cell.closest("table");
22576
22799
  if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
22577
- if (beginResize(event, table, row, cell)) {
22578
- suppressActiveCellHighlightRef.current = true;
22579
- updateActiveCellHighlight(null);
22800
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
22801
+ if (rowTarget) {
22802
+ event.preventDefault();
22803
+ event.stopPropagation();
22804
+ window.getSelection()?.removeAllRanges();
22805
+ if (beginResize(event, table, rowTarget.row, rowTarget.cell)) {
22806
+ suppressActiveCellHighlightRef.current = true;
22807
+ updateActiveCellHighlight(null);
22808
+ return;
22809
+ }
22580
22810
  }
22811
+ setActiveTableCell(cell);
22812
+ scheduleActiveCellSync(cell);
22581
22813
  };
22582
22814
  const handlePointerMove = (event) => {
22583
22815
  handleRowResizePointerMove(event);
@@ -22666,8 +22898,9 @@ function useUEditorTableInteractions(editor, editable = true) {
22666
22898
  clearActiveTableCell();
22667
22899
  clearHoveredTableCell();
22668
22900
  clearAllTableResizeHover();
22901
+ clearHotspotTimer();
22669
22902
  };
22670
- }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
22903
+ }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHotspotTimer, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
22671
22904
  return {
22672
22905
  editorContentRef,
22673
22906
  tableColumnGuideRef,
@@ -23429,6 +23662,7 @@ var UEditor = import_react44.default.forwardRef(({
23429
23662
  variant = "default",
23430
23663
  rounded = true,
23431
23664
  fontFamilies,
23665
+ defaultFontFamily = "Inter",
23432
23666
  fontSizes,
23433
23667
  lineHeights,
23434
23668
  letterSpacings,
@@ -23453,6 +23687,10 @@ var UEditor = import_react44.default.forwardRef(({
23453
23687
  const formulaRangePickRef = (0, import_react44.useRef)(null);
23454
23688
  const formulaRangeSurfaceRef = (0, import_react44.useRef)(null);
23455
23689
  const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react44.default.useState(null);
23690
+ const [isMenuBarVisible, setIsMenuBarVisible] = import_react44.default.useState(showMenuBar);
23691
+ (0, import_react44.useEffect)(() => {
23692
+ setIsMenuBarVisible(showMenuBar);
23693
+ }, [showMenuBar]);
23456
23694
  const { flushOutputUpdates, scheduleOutputUpdate } = useUEditorOutput({
23457
23695
  onChange,
23458
23696
  onHtmlChange,
@@ -23711,7 +23949,7 @@ var UEditor = import_react44.default.forwardRef(({
23711
23949
  ),
23712
23950
  children: [
23713
23951
  editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(EditorUiRenderStateProvider, { editor, children: [
23714
- showMenuBar && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react44.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
23952
+ isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react44.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
23715
23953
  LazyMenuBar,
23716
23954
  {
23717
23955
  editor,
@@ -23732,11 +23970,14 @@ var UEditor = import_react44.default.forwardRef(({
23732
23970
  {
23733
23971
  editor,
23734
23972
  variant,
23973
+ isMenuBarVisible,
23974
+ onToggleMenuBar: () => setIsMenuBarVisible((visible) => !visible),
23735
23975
  uploadImage,
23736
23976
  imageInsertMode,
23737
23977
  maxImageFileSize,
23738
23978
  allowedImageMimeTypes,
23739
23979
  fontFamilies,
23980
+ defaultFontFamily,
23740
23981
  fontSizes,
23741
23982
  lineHeights,
23742
23983
  letterSpacings
@@ -23762,6 +24003,7 @@ var UEditor = import_react44.default.forwardRef(({
23762
24003
  },
23763
24004
  className: "relative flex-1 overflow-y-auto",
23764
24005
  style: {
24006
+ fontFamily: defaultFontFamily,
23765
24007
  minHeight: editable ? minHeight : void 0,
23766
24008
  maxHeight
23767
24009
  },
@@ -23771,7 +24013,7 @@ var UEditor = import_react44.default.forwardRef(({
23771
24013
  {
23772
24014
  ref: tableColumnGuideRef,
23773
24015
  "aria-hidden": "true",
23774
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
24016
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
23775
24017
  }
23776
24018
  ),
23777
24019
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -23779,7 +24021,7 @@ var UEditor = import_react44.default.forwardRef(({
23779
24021
  {
23780
24022
  ref: tableRowGuideRef,
23781
24023
  "aria-hidden": "true",
23782
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
24024
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
23783
24025
  }
23784
24026
  ),
23785
24027
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -23788,7 +24030,7 @@ var UEditor = import_react44.default.forwardRef(({
23788
24030
  ref: activeTableCellHighlightRef,
23789
24031
  "aria-hidden": "true",
23790
24032
  "data-ueditor-active-cell-highlight": "",
23791
- className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
24033
+ className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
23792
24034
  }
23793
24035
  ),
23794
24036
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(