@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/index.cjs CHANGED
@@ -364,7 +364,9 @@ var init_en = __esm({
364
364
  imageWidthMd: "Image Width Medium",
365
365
  imageWidthLg: "Image Width Large",
366
366
  imageResetSize: "Reset Image Size",
367
- imageDelete: "Delete Image"
367
+ imageDelete: "Delete Image",
368
+ hideMenuBar: "Hide menu bar",
369
+ showMenuBar: "Show menu bar"
368
370
  },
369
371
  slashCommand: {
370
372
  basicBlocks: "Basic Blocks",
@@ -822,7 +824,9 @@ var init_vi = __esm({
822
824
  imageWidthMd: "\u1EA2nh V\u1EEBa",
823
825
  imageWidthLg: "\u1EA2nh L\u1EDBn",
824
826
  imageResetSize: "\u0110\u1EB7t L\u1EA1i K\xEDch Th\u01B0\u1EDBc \u1EA2nh",
825
- imageDelete: "X\xF3a \u1EA2nh"
827
+ imageDelete: "X\xF3a \u1EA2nh",
828
+ hideMenuBar: "\u1EA8n thanh menu",
829
+ showMenuBar: "Hi\u1EC7n thanh menu"
826
830
  },
827
831
  slashCommand: {
828
832
  basicBlocks: "Kh\u1ED1i c\u01A1 b\u1EA3n",
@@ -1280,7 +1284,9 @@ var init_ko = __esm({
1280
1284
  imageWidthMd: "\uC911\uAC04 \uC774\uBBF8\uC9C0",
1281
1285
  imageWidthLg: "\uD070 \uC774\uBBF8\uC9C0",
1282
1286
  imageResetSize: "\uC774\uBBF8\uC9C0 \uD06C\uAE30 \uCD08\uAE30\uD654",
1283
- imageDelete: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C"
1287
+ imageDelete: "\uC774\uBBF8\uC9C0 \uC0AD\uC81C",
1288
+ hideMenuBar: "\uBA54\uB274 \uBAA8\uC74C \uC228\uAE30\uAE30",
1289
+ showMenuBar: "\uBA54\uB274 \uBAA8\uC74C \uD45C\uC2DC"
1284
1290
  },
1285
1291
  slashCommand: {
1286
1292
  basicBlocks: "\uAE30\uBCF8 \uBE14\uB85D",
@@ -1738,7 +1744,9 @@ var init_ja = __esm({
1738
1744
  imageWidthMd: "\u753B\u50CF\uFF08\u4E2D\uFF09",
1739
1745
  imageWidthLg: "\u753B\u50CF\uFF08\u5927\uFF09",
1740
1746
  imageResetSize: "\u753B\u50CF\u30B5\u30A4\u30BA\u3092\u30EA\u30BB\u30C3\u30C8",
1741
- imageDelete: "\u753B\u50CF\u3092\u524A\u9664"
1747
+ imageDelete: "\u753B\u50CF\u3092\u524A\u9664",
1748
+ hideMenuBar: "\u30E1\u30CB\u30E5\u30FC\u30D0\u30FC\u3092\u975E\u8868\u793A",
1749
+ showMenuBar: "\u30E1\u30CB\u30E5\u30FC\u30D0\u30FC\u3092\u8868\u793A"
1742
1750
  },
1743
1751
  slashCommand: {
1744
1752
  basicBlocks: "\u57FA\u672C\u30D6\u30ED\u30C3\u30AF",
@@ -5848,17 +5856,60 @@ function getSelectionTableCell(view) {
5848
5856
  const cell = element?.closest?.("th,td");
5849
5857
  return cell instanceof HTMLElement ? cell : null;
5850
5858
  }
5851
- function isRowResizeHotspot(cell, clientX, clientY) {
5859
+ function resolveRowResizeTarget(cell, clientX, clientY) {
5852
5860
  const rect = cell.getBoundingClientRect();
5853
- const nearBottom = rect.bottom - clientY <= TABLE_RESIZE_HIT_ZONE;
5854
- const nearRight = rect.right - clientX <= TABLE_RESIZE_HIT_ZONE;
5855
- return nearBottom && !nearRight;
5861
+ const row = cell.closest("tr");
5862
+ if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
5863
+ return null;
5864
+ }
5865
+ const distToBottom = Math.abs(clientY - rect.bottom);
5866
+ const distToTop = Math.abs(clientY - rect.top);
5867
+ const distToRight = Math.abs(clientX - rect.right);
5868
+ const distToLeft = Math.abs(clientX - rect.left);
5869
+ if (distToRight <= 3 || distToLeft <= 3) {
5870
+ return null;
5871
+ }
5872
+ if (distToBottom <= TABLE_RESIZE_HIT_ZONE) {
5873
+ return { row, cell };
5874
+ }
5875
+ if (distToTop <= TABLE_RESIZE_HIT_ZONE) {
5876
+ const prevRow = row.previousElementSibling;
5877
+ if (prevRow instanceof HTMLTableRowElement) {
5878
+ const cellIndex = cell.cellIndex;
5879
+ const prevCell = prevRow.children[cellIndex] ?? prevRow.firstElementChild;
5880
+ if (prevCell instanceof HTMLTableCellElement) {
5881
+ return { row: prevRow, cell: prevCell };
5882
+ }
5883
+ }
5884
+ }
5885
+ return null;
5856
5886
  }
5857
- function isColumnResizeHotspot(cell, clientX, clientY) {
5887
+ function resolveColumnResizeTarget(cell, clientX, clientY) {
5858
5888
  const rect = cell.getBoundingClientRect();
5859
- const nearRight = rect.right - clientX <= TABLE_RESIZE_HIT_ZONE;
5860
- const nearBottom = rect.bottom - clientY <= TABLE_RESIZE_HIT_ZONE;
5861
- return nearRight && !nearBottom;
5889
+ const row = cell.closest("tr");
5890
+ if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
5891
+ return null;
5892
+ }
5893
+ const distToRight = Math.abs(clientX - rect.right);
5894
+ const distToLeft = Math.abs(clientX - rect.left);
5895
+ const distToBottom = Math.abs(clientY - rect.bottom);
5896
+ const distToTop = Math.abs(clientY - rect.top);
5897
+ if (distToBottom <= 3 || distToTop <= 3) {
5898
+ return null;
5899
+ }
5900
+ if (distToRight <= TABLE_RESIZE_HIT_ZONE) {
5901
+ return { row, cell };
5902
+ }
5903
+ if (distToLeft <= TABLE_RESIZE_HIT_ZONE) {
5904
+ const prevCell = cell.previousElementSibling;
5905
+ if (prevCell instanceof HTMLTableCellElement) {
5906
+ return { row, cell: prevCell };
5907
+ }
5908
+ }
5909
+ return null;
5910
+ }
5911
+ function isRowResizeHotspot(cell, clientX, clientY) {
5912
+ return resolveRowResizeTarget(cell, clientX, clientY) !== null;
5862
5913
  }
5863
5914
  function getRelativeBoundaryMetrics(surface, table, row, cell) {
5864
5915
  const surfaceRect = surface.getBoundingClientRect();
@@ -5910,7 +5961,7 @@ function getRelativeSelectedCellsMetrics(surface) {
5910
5961
  height: bottom - top
5911
5962
  };
5912
5963
  }
5913
- 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;
5964
+ 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;
5914
5965
  var init_table_dom_utils = __esm({
5915
5966
  "src/components/UEditor/table-dom-utils.ts"() {
5916
5967
  "use strict";
@@ -5918,8 +5969,9 @@ var init_table_dom_utils = __esm({
5918
5969
  MIN_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
5919
5970
  COLUMN_RESIZE_LINE_THICKNESS = 2;
5920
5971
  ROW_RESIZE_LINE_THICKNESS = 2;
5921
- UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor-table-layout-change";
5922
- TABLE_RESIZE_HIT_ZONE = 10;
5972
+ UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor:table-layout-change";
5973
+ isRowResizingGlobal = { active: false };
5974
+ TABLE_RESIZE_HIT_ZONE = 5;
5923
5975
  }
5924
5976
  });
5925
5977
 
@@ -6629,6 +6681,18 @@ var init_colors = __esm({
6629
6681
  const automaticColor = colors[0]?.color ?? "";
6630
6682
  const paletteColors = colors.slice(1);
6631
6683
  const customColorSelect = onCustomColorSelect ?? onSelect;
6684
+ const [hexInput, setHexInput] = import_react71.default.useState(currentColor.startsWith("#") ? currentColor : "");
6685
+ import_react71.default.useEffect(() => {
6686
+ setHexInput(currentColor.startsWith("#") ? currentColor : "");
6687
+ }, [currentColor]);
6688
+ const commitHex = (val) => {
6689
+ let formatted = val.trim();
6690
+ if (!formatted) return;
6691
+ if (!formatted.startsWith("#")) formatted = `#${formatted}`;
6692
+ if (/^#([0-9A-F]{3}){1,2}$/i.test(formatted)) {
6693
+ customColorSelect(formatted);
6694
+ }
6695
+ };
6632
6696
  import_react71.default.useEffect(() => {
6633
6697
  const input = colorInputRef.current;
6634
6698
  if (!input) return;
@@ -6640,7 +6704,7 @@ var init_colors = __esm({
6640
6704
  const input = colorInputRef.current;
6641
6705
  if (input) input.value = currentColor.startsWith("#") ? currentColor : "#000000";
6642
6706
  }, [currentColor]);
6643
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "w-56 p-2", children: [
6707
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "w-56 p-2", "data-ueditor-keep-open": true, children: [
6644
6708
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
6645
6709
  /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
6646
6710
  "button",
@@ -6674,29 +6738,48 @@ var init_colors = __esm({
6674
6738
  children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Check, { className: cn("h-3.5 w-3.5", getSwatchCheckClass(c.color)) }) })
6675
6739
  }
6676
6740
  ) }, `${c.name}-${c.color}`)) }),
6677
- /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
6678
- "button",
6679
- {
6680
- type: "button",
6681
- onMouseDown: (e) => e.preventDefault(),
6682
- onClick: () => colorInputRef.current?.click(),
6683
- 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",
6684
- children: [
6685
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
6686
- "span",
6687
- {
6688
- "aria-hidden": "true",
6689
- className: "h-5 w-5 rounded border border-border",
6690
- style: {
6691
- background: "linear-gradient(135deg, #ff004c 0%, #fffb00 22%, #00ff66 42%, #00d5ff 62%, #2446ff 78%, #ff00d4 100%)"
6741
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
6742
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex h-8 flex-1 items-center gap-1.5 rounded-md border border-input bg-muted/30 px-2", children: [
6743
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
6744
+ "span",
6745
+ {
6746
+ className: "h-4 w-4 shrink-0 rounded-[2px] border border-border",
6747
+ style: { backgroundColor: hexInput.startsWith("#") ? hexInput : currentColor.startsWith("#") ? currentColor : "transparent" }
6748
+ }
6749
+ ),
6750
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
6751
+ "input",
6752
+ {
6753
+ type: "text",
6754
+ value: hexInput,
6755
+ onChange: (e) => setHexInput(e.target.value),
6756
+ onBlur: () => commitHex(hexInput),
6757
+ onMouseDown: (e) => e.stopPropagation(),
6758
+ onClick: (e) => e.stopPropagation(),
6759
+ onKeyDown: (e) => {
6760
+ e.stopPropagation();
6761
+ if (e.key === "Enter") {
6762
+ e.preventDefault();
6763
+ commitHex(hexInput);
6692
6764
  }
6693
- }
6694
- ),
6695
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
6696
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Palette, { className: "h-4 w-4 text-muted-foreground" })
6697
- ]
6698
- }
6699
- ),
6765
+ },
6766
+ placeholder: "#HEX",
6767
+ className: "h-full w-full bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground"
6768
+ }
6769
+ )
6770
+ ] }),
6771
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
6772
+ "button",
6773
+ {
6774
+ type: "button",
6775
+ onMouseDown: (e) => e.stopPropagation(),
6776
+ onClick: () => colorInputRef.current?.click(),
6777
+ title: t("colors.moreColors"),
6778
+ 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",
6779
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Palette, { className: "h-4 w-4 text-muted-foreground" })
6780
+ }
6781
+ )
6782
+ ] }),
6700
6783
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
6701
6784
  "input",
6702
6785
  {
@@ -7270,7 +7353,7 @@ var init_toolbar = __esm({
7270
7353
  return button;
7271
7354
  });
7272
7355
  ToolbarButton.displayName = "ToolbarButton";
7273
- ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-1.5 h-7 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
7356
+ ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-1 h-5 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
7274
7357
  TableInsertGrid = ({
7275
7358
  insertLabel,
7276
7359
  previewTemplate,
@@ -7310,11 +7393,14 @@ var init_toolbar = __esm({
7310
7393
  EditorToolbar = ({
7311
7394
  editor,
7312
7395
  variant,
7396
+ isMenuBarVisible,
7397
+ onToggleMenuBar,
7313
7398
  uploadImage,
7314
7399
  imageInsertMode = "base64",
7315
7400
  maxImageFileSize = DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
7316
7401
  allowedImageMimeTypes = DEFAULT_UEDITOR_IMAGE_MIME_TYPES,
7317
7402
  fontFamilies,
7403
+ defaultFontFamily = "Inter",
7318
7404
  fontSizes,
7319
7405
  lineHeights,
7320
7406
  letterSpacings
@@ -7357,9 +7443,9 @@ var init_toolbar = __esm({
7357
7443
  const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
7358
7444
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
7359
7445
  const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
7360
- const defaultFontFamily = availableFontFamilies[0];
7361
- const defaultFontFamilyValue = defaultFontFamily?.value ?? "";
7362
- const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel : defaultFontFamily?.label ?? t("toolbar.fontDefault");
7446
+ const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
7447
+ const defaultFontFamilyValue = defaultFontFamilyOption?.value ?? defaultFontFamily ?? "Inter";
7448
+ const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel : defaultFontFamilyOption?.label ?? defaultFontFamily ?? t("toolbar.fontDefault");
7363
7449
  const displayedFontFamilyValue = currentFontFamily || defaultFontFamilyValue;
7364
7450
  const displayedFontSizeLabel = currentFontSize ? currentFontSizeLabel : "13";
7365
7451
  const activeFontSize = currentFontSize || "13px";
@@ -7483,6 +7569,15 @@ var init_toolbar = __esm({
7483
7569
  )
7484
7570
  ] })
7485
7571
  }
7572
+ ),
7573
+ onToggleMenuBar && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7574
+ ToolbarButton,
7575
+ {
7576
+ onClick: onToggleMenuBar,
7577
+ active: isMenuBarVisible,
7578
+ title: t(isMenuBarVisible ? "toolbar.hideMenuBar" : "toolbar.showMenuBar"),
7579
+ children: isMenuBarVisible ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.PanelTopClose, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.PanelTopOpen, { className: "h-4 w-4" })
7580
+ }
7486
7581
  )
7487
7582
  ] });
7488
7583
  }
@@ -7491,7 +7586,7 @@ var init_toolbar = __esm({
7491
7586
  "div",
7492
7587
  {
7493
7588
  role: "toolbar",
7494
- 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",
7589
+ 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",
7495
7590
  children: [
7496
7591
  isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7497
7592
  DropdownMenu,
@@ -7502,9 +7597,9 @@ var init_toolbar = __esm({
7502
7597
  onClick: () => {
7503
7598
  },
7504
7599
  title: t("toolbar.fontFamily"),
7505
- 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",
7600
+ 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",
7506
7601
  children: [
7507
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
7602
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-xs font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
7508
7603
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7509
7604
  ]
7510
7605
  }
@@ -7531,9 +7626,9 @@ var init_toolbar = __esm({
7531
7626
  onClick: () => {
7532
7627
  },
7533
7628
  title: t("toolbar.fontSize"),
7534
- 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",
7629
+ 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",
7535
7630
  children: [
7536
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-sm font-normal leading-none", children: displayedFontSizeLabel }),
7631
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
7537
7632
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7538
7633
  ]
7539
7634
  }
@@ -7658,6 +7753,27 @@ var init_toolbar = __esm({
7658
7753
  )
7659
7754
  ] }),
7660
7755
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
7756
+ (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7757
+ DropdownMenu,
7758
+ {
7759
+ isOpen: isTableMenuOpen,
7760
+ onOpenChange: setIsTableMenuOpen,
7761
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
7762
+ }, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
7763
+ contentClassName: "p-2 min-w-56",
7764
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
7765
+ TableInsertGrid,
7766
+ {
7767
+ insertLabel: t("tableMenu.insertTable"),
7768
+ previewTemplate: t("tableMenu.gridPreview"),
7769
+ onInsert: (rows, cols) => {
7770
+ editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
7771
+ setIsTableMenuOpen(false);
7772
+ }
7773
+ }
7774
+ )
7775
+ }
7776
+ ),
7661
7777
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaBoldIcon, { className: "h-4 w-4" }) }),
7662
7778
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaItalicIcon, { className: "h-4 w-4" }) }),
7663
7779
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
@@ -8128,27 +8244,6 @@ var init_toolbar = __esm({
8128
8244
  ] })
8129
8245
  }
8130
8246
  ),
8131
- (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8132
- DropdownMenu,
8133
- {
8134
- isOpen: isTableMenuOpen,
8135
- onOpenChange: setIsTableMenuOpen,
8136
- trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
8137
- }, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
8138
- contentClassName: "p-2 min-w-56",
8139
- children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8140
- TableInsertGrid,
8141
- {
8142
- insertLabel: t("tableMenu.insertTable"),
8143
- previewTemplate: t("tableMenu.gridPreview"),
8144
- onInsert: (rows, cols) => {
8145
- editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
8146
- setIsTableMenuOpen(false);
8147
- }
8148
- }
8149
- )
8150
- }
8151
- ),
8152
8247
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
8153
8248
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaUndoIcon, { className: "h-4 w-4" }) }),
8154
8249
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaRedoIcon, { className: "h-4 w-4" }) }),
@@ -8206,7 +8301,16 @@ var init_toolbar = __esm({
8206
8301
  children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.TableCellsMerge, { className: "w-4 h-4" })
8207
8302
  }
8208
8303
  )
8209
- ] })
8304
+ ] }),
8305
+ onToggleMenuBar && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8306
+ ToolbarButton,
8307
+ {
8308
+ onClick: onToggleMenuBar,
8309
+ active: isMenuBarVisible,
8310
+ title: t(isMenuBarVisible ? "toolbar.hideMenuBar" : "toolbar.showMenuBar"),
8311
+ children: isMenuBarVisible ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.PanelTopClose, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.PanelTopOpen, { className: "h-4 w-4" })
8312
+ }
8313
+ )
8210
8314
  ]
8211
8315
  }
8212
8316
  );
@@ -8347,7 +8451,7 @@ var init_editor_styles = __esm({
8347
8451
  "[&_.selectedCell]:after:absolute",
8348
8452
  "[&_.selectedCell]:after:inset-0",
8349
8453
  "[&_.selectedCell]:after:z-[2]",
8350
- "[&_.selectedCell]:after:bg-primary/15",
8454
+ "[&_.selectedCell]:after:bg-primary/8",
8351
8455
  "[&_.selectedCell]:after:pointer-events-none",
8352
8456
  "[&_.column-resize-handle]:pointer-events-auto",
8353
8457
  "[&_.column-resize-handle]:cursor-col-resize",
@@ -8361,17 +8465,10 @@ var init_editor_styles = __esm({
8361
8465
  "[&_.column-resize-handle]:rounded-none",
8362
8466
  "[&_.column-resize-handle]:opacity-0",
8363
8467
  "[&_.column-resize-handle]:transition-opacity",
8364
- "[&_.column-resize-handle]:after:absolute",
8365
- "[&_.column-resize-handle]:after:top-0",
8366
- "[&_.column-resize-handle]:after:bottom-0",
8367
- "[&_.column-resize-handle]:after:left-1/2",
8368
- "[&_.column-resize-handle]:after:w-0.5",
8369
- "[&_.column-resize-handle]:after:-translate-x-1/2",
8370
- "[&_.column-resize-handle]:after:rounded-full",
8371
- "[&_.column-resize-handle]:after:bg-primary/75",
8372
- "[&_.column-resize-handle]:after:content-['']",
8373
- "[&.resize-cursor_.column-resize-handle]:opacity-100",
8374
- "[&.resize-cursor_.column-resize-handle]:after:bg-primary",
8468
+ "[&_.column-resize-handle]:duration-200",
8469
+ "[&_.column-resize-handle]:delay-100",
8470
+ "[&_.column-resize-handle]:ease-out",
8471
+ "[&_.column-resize-handle]:after:hidden",
8375
8472
  "[&_.column-resize-dragging]:min-w-0",
8376
8473
  "[&.resize-cursor]:cursor-col-resize",
8377
8474
  "[&.resize-row-cursor]:cursor-row-resize",
@@ -36474,6 +36571,15 @@ function edgeCell(view, event, side, handleWidth) {
36474
36571
  const index = map.map.indexOf($cell.pos - start);
36475
36572
  return index % map.width === 0 ? -1 : start + map.map[index - 1];
36476
36573
  }
36574
+ var handleHoverTimer = null;
36575
+ var pendingHandleCell = -1;
36576
+ function clearHandleHoverTimer() {
36577
+ if (handleHoverTimer !== null) {
36578
+ window.clearTimeout(handleHoverTimer);
36579
+ handleHoverTimer = null;
36580
+ }
36581
+ pendingHandleCell = -1;
36582
+ }
36477
36583
  function updateHandle(view, value) {
36478
36584
  view.dispatch(view.state.tr.setMeta(import_tables2.columnResizingPluginKey, { setHandle: value }));
36479
36585
  }
@@ -36488,19 +36594,43 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
36488
36594
  if (event.clientX - left <= handleWidth) cell = edgeCell(view, event, "left", handleWidth);
36489
36595
  else if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, "right", handleWidth);
36490
36596
  }
36491
- if (cell === pluginState.activeHandle) return;
36492
- if (!lastColumnResizable && cell !== -1) {
36597
+ if (cell === pluginState.activeHandle) {
36598
+ clearHandleHoverTimer();
36599
+ return;
36600
+ }
36601
+ if (cell === -1) {
36602
+ clearHandleHoverTimer();
36603
+ if (pluginState.activeHandle !== -1) {
36604
+ updateHandle(view, -1);
36605
+ }
36606
+ return;
36607
+ }
36608
+ if (!lastColumnResizable) {
36493
36609
  const $cell = view.state.doc.resolve(cell);
36494
36610
  const table = $cell.node(-1);
36495
36611
  const map = import_tables2.TableMap.get(table);
36496
36612
  const tableStart = $cell.start(-1);
36497
36613
  const nodeAfter = $cell.nodeAfter;
36498
36614
  if (!nodeAfter) return;
36499
- if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) return;
36615
+ if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) {
36616
+ clearHandleHoverTimer();
36617
+ if (pluginState.activeHandle !== -1) {
36618
+ updateHandle(view, -1);
36619
+ }
36620
+ return;
36621
+ }
36500
36622
  }
36501
- updateHandle(view, cell);
36623
+ if (pendingHandleCell === cell) return;
36624
+ clearHandleHoverTimer();
36625
+ pendingHandleCell = cell;
36626
+ handleHoverTimer = window.setTimeout(() => {
36627
+ handleHoverTimer = null;
36628
+ pendingHandleCell = -1;
36629
+ updateHandle(view, cell);
36630
+ }, 100);
36502
36631
  }
36503
36632
  function handleMouseLeave(view) {
36633
+ clearHandleHoverTimer();
36504
36634
  if (!view.editable) return;
36505
36635
  const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
36506
36636
  if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) {
@@ -36549,7 +36679,7 @@ function getColumnResizeGhost(view) {
36549
36679
  ghost.style.pointerEvents = "none";
36550
36680
  ghost.style.width = "2px";
36551
36681
  ghost.style.backgroundColor = "var(--primary, #2563eb)";
36552
- ghost.style.opacity = "1";
36682
+ ghost.style.opacity = "0.5";
36553
36683
  ghost.style.borderRadius = "9999px";
36554
36684
  ghost.style.boxShadow = "0 0 0 1px color-mix(in oklch, var(--background, #fff) 80%, transparent)";
36555
36685
  ghost.style.transform = "translateX(-1px)";
@@ -36578,6 +36708,7 @@ function showColumnResizeGhost(view, cell, dragging, width) {
36578
36708
  ghost.style.height = `${rect.height}px`;
36579
36709
  }
36580
36710
  function handleMouseDown(view, event, cellMinWidth) {
36711
+ clearHandleHoverTimer();
36581
36712
  if (!view.editable) return false;
36582
36713
  const win = view.dom.ownerDocument.defaultView ?? window;
36583
36714
  const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
@@ -36699,6 +36830,7 @@ function dynamicColumnResizing({
36699
36830
 
36700
36831
  // src/components/UEditor/table-align.ts
36701
36832
  init_table_align_utils();
36833
+ init_table_dom_utils();
36702
36834
  function normalizeTableAlign(value) {
36703
36835
  if (value === "left" || value === "center" || value === "right") {
36704
36836
  return value;
@@ -36825,6 +36957,38 @@ var UEditorTable = import_extension_table.Table.extend({
36825
36957
  lastColumnResizable: this.options.lastColumnResizable
36826
36958
  })
36827
36959
  ] : [],
36960
+ new import_state7.Plugin({
36961
+ key: new import_state7.PluginKey("tableRowResizeInterceptor"),
36962
+ props: {
36963
+ handleDOMEvents: {
36964
+ mousedown(view, event) {
36965
+ if (event.button !== 0) return false;
36966
+ const target = resolveEventElement(event.target);
36967
+ const cell = target?.closest("th,td");
36968
+ if (cell instanceof HTMLElement && isRowResizeHotspot(cell, event.clientX, event.clientY)) {
36969
+ isRowResizingGlobal.active = true;
36970
+ return true;
36971
+ }
36972
+ return false;
36973
+ },
36974
+ mousemove(_view, event) {
36975
+ if (isRowResizingGlobal.active) {
36976
+ if (event.buttons === 0) {
36977
+ isRowResizingGlobal.active = false;
36978
+ return false;
36979
+ }
36980
+ event.preventDefault();
36981
+ return true;
36982
+ }
36983
+ return false;
36984
+ },
36985
+ mouseup() {
36986
+ isRowResizingGlobal.active = false;
36987
+ return false;
36988
+ }
36989
+ }
36990
+ }
36991
+ }),
36828
36992
  (0, import_tables3.tableEditing)({
36829
36993
  allowTableNodeSelection: this.options.allowTableNodeSelection
36830
36994
  }),
@@ -39984,7 +40148,11 @@ var CustomBubbleMenu = ({
39984
40148
  setIsVisible(false);
39985
40149
  return;
39986
40150
  }
39987
- if (!keepOpenRef.current && (context2 === "none" || !view.hasFocus())) {
40151
+ const isInputFocused = () => {
40152
+ const active = document.activeElement;
40153
+ return Boolean(active && (menuRef.current?.contains(active) || active.closest?.("[data-ueditor-keep-open]")));
40154
+ };
40155
+ if (!keepOpenRef.current && !isInputFocused() && (context2 === "none" || !view.hasFocus())) {
39988
40156
  clearShowTimeout();
39989
40157
  setIsVisible(false);
39990
40158
  return;
@@ -40025,7 +40193,8 @@ var CustomBubbleMenu = ({
40025
40193
  }, SHOW_DELAY_MS);
40026
40194
  };
40027
40195
  const handleBlur = () => {
40028
- if (!keepOpenRef.current) {
40196
+ const isInputFocused = Boolean(document.activeElement && (menuRef.current?.contains(document.activeElement) || document.activeElement.closest?.("[data-ueditor-keep-open]")));
40197
+ if (!keepOpenRef.current && !isInputFocused) {
40029
40198
  clearShowTimeout();
40030
40199
  setIsVisible(false);
40031
40200
  }
@@ -40119,6 +40288,9 @@ var CustomBubbleMenu = ({
40119
40288
  } else if (target?.closest?.("[data-ueditor-keep-open]")) {
40120
40289
  setKeepOpen(true);
40121
40290
  }
40291
+ if (target && target.closest("input, textarea, select")) {
40292
+ return;
40293
+ }
40122
40294
  e.preventDefault();
40123
40295
  },
40124
40296
  children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
@@ -43692,7 +43864,7 @@ function createKey(name) {
43692
43864
  keys[name] = 0;
43693
43865
  return name + "$";
43694
43866
  }
43695
- var PluginKey6 = class {
43867
+ var PluginKey7 = class {
43696
43868
  /**
43697
43869
  Create a plugin key.
43698
43870
  */
@@ -44124,7 +44296,7 @@ function tableNodeTypes2(schema) {
44124
44296
  }
44125
44297
  return result;
44126
44298
  }
44127
- var tableEditingKey = new PluginKey6("selectingCells");
44299
+ var tableEditingKey = new PluginKey7("selectingCells");
44128
44300
  function cellAround2($pos) {
44129
44301
  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));
44130
44302
  return null;
@@ -44355,7 +44527,7 @@ var CellBookmark = class CellBookmark2 {
44355
44527
  else return Selection.near($headCell, 1);
44356
44528
  }
44357
44529
  };
44358
- var fixTablesKey = new PluginKey6("fix-tables");
44530
+ var fixTablesKey = new PluginKey7("fix-tables");
44359
44531
  function convertTableNodeToArrayOfRows(tableNode) {
44360
44532
  const map = TableMap4.get(tableNode);
44361
44533
  const rows = [];
@@ -44833,7 +45005,7 @@ function atEndOfCell(view, axis, dir) {
44833
45005
  }
44834
45006
  return null;
44835
45007
  }
44836
- var columnResizingPluginKey2 = new PluginKey6("tableColumnResizing");
45008
+ var columnResizingPluginKey2 = new PluginKey7("tableColumnResizing");
44837
45009
 
44838
45010
  // src/components/UEditor/table-controls.tsx
44839
45011
  var import_lucide_react57 = require("lucide-react");
@@ -45282,6 +45454,8 @@ init_Tooltip();
45282
45454
  var import_jsx_runtime97 = require("react/jsx-runtime");
45283
45455
  var ADD_COLUMN_RAIL_GAP = 4;
45284
45456
  var ADD_ROW_RAIL_GAP = 4;
45457
+ var BUTTON_LONG_SIZE = 36;
45458
+ var BUTTON_SHORT_SIZE = 14;
45285
45459
  function TableAddRails({
45286
45460
  addColumnVisible,
45287
45461
  addRowVisible,
@@ -45294,10 +45468,10 @@ function TableAddRails({
45294
45468
  quickAddRowLabel
45295
45469
  }) {
45296
45470
  const visibleBounds = getVisibleTableBounds(layout);
45297
- const columnRailTop = visibleBounds.top;
45471
+ const columnRailTop = visibleBounds.top + Math.max(0, (visibleBounds.height - BUTTON_LONG_SIZE) / 2);
45298
45472
  const columnRailLeft = visibleBounds.right + ADD_COLUMN_RAIL_GAP;
45299
45473
  const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
45300
- const rowRailLeft = visibleBounds.left;
45474
+ const rowRailLeft = visibleBounds.left + Math.max(0, (visibleBounds.width - BUTTON_LONG_SIZE) / 2);
45301
45475
  const showColumnRail = controlsVisible || addColumnVisible;
45302
45476
  const showRowRail = controlsVisible || addRowVisible;
45303
45477
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
@@ -45322,15 +45496,15 @@ function TableAddRails({
45322
45496
  className: cn(
45323
45497
  "absolute z-30 inline-flex items-center justify-center rounded-md",
45324
45498
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
45325
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
45499
+ "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"
45326
45500
  ),
45327
45501
  style: {
45328
- top: showColumnRail ? columnRailTop : columnRailTop + Math.max(0, visibleBounds.height / 2 - 24),
45502
+ top: columnRailTop,
45329
45503
  left: columnRailLeft,
45330
- width: showColumnRail ? 18 : 12,
45331
- height: showColumnRail ? visibleBounds.height : 48,
45504
+ width: BUTTON_SHORT_SIZE,
45505
+ height: BUTTON_LONG_SIZE,
45332
45506
  opacity: showColumnRail ? 1 : 0,
45333
- transform: showColumnRail ? "scale(1)" : "scale(0.92)",
45507
+ transform: showColumnRail ? "scale(1)" : "scale(0.85)",
45334
45508
  pointerEvents: showColumnRail ? "auto" : "none"
45335
45509
  },
45336
45510
  children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -45359,15 +45533,15 @@ function TableAddRails({
45359
45533
  className: cn(
45360
45534
  "absolute z-30 inline-flex items-center justify-center rounded-md",
45361
45535
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
45362
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
45536
+ "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"
45363
45537
  ),
45364
45538
  style: {
45365
45539
  top: rowRailTop,
45366
- left: showRowRail ? rowRailLeft : rowRailLeft + Math.max(0, visibleBounds.width / 2 - 24),
45367
- width: showRowRail ? visibleBounds.width : 48,
45368
- height: showRowRail ? 16 : 12,
45540
+ left: rowRailLeft,
45541
+ width: BUTTON_LONG_SIZE,
45542
+ height: BUTTON_SHORT_SIZE,
45369
45543
  opacity: showRowRail ? 1 : 0,
45370
- transform: showRowRail ? "scale(1)" : "scale(0.92)",
45544
+ transform: showRowRail ? "scale(1)" : "scale(0.85)",
45371
45545
  pointerEvents: showRowRail ? "auto" : "none"
45372
45546
  },
45373
45547
  children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -45504,7 +45678,7 @@ function TableRowHandles({
45504
45678
  onStartDrag(rowHandle);
45505
45679
  },
45506
45680
  className: cn(
45507
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
45681
+ "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",
45508
45682
  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"
45509
45683
  ),
45510
45684
  style: {
@@ -45579,7 +45753,7 @@ function TableColumnHandles({
45579
45753
  onStartDrag(columnHandle);
45580
45754
  },
45581
45755
  className: cn(
45582
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
45756
+ "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",
45583
45757
  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"
45584
45758
  ),
45585
45759
  style: {
@@ -45968,7 +46142,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
45968
46142
  const updateHoverState = import_react77.default.useCallback((event) => {
45969
46143
  const activeLayout = layoutRef.current;
45970
46144
  const surface = containerRef.current;
45971
- if (!activeLayout || !surface || dragStateRef.current) {
46145
+ if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
45972
46146
  setHoverState(DEFAULT_TABLE_HOVER_STATE);
45973
46147
  return;
45974
46148
  }
@@ -46102,7 +46276,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
46102
46276
  return result;
46103
46277
  }, [editor, scheduleSyncFromSelection]);
46104
46278
  const canExpandTable = Boolean(layout);
46105
- const controlsVisible = dragPreview !== null;
46279
+ const controlsVisible = false;
46106
46280
  const tableMenuOpen = openMenuKey === "table";
46107
46281
  const startTableResize = import_react77.default.useCallback((event) => {
46108
46282
  if (event.button !== 0 || dragStateRef.current) return;
@@ -46629,6 +46803,9 @@ function useTableRowResize({
46629
46803
  pendingHeight: startHeight
46630
46804
  };
46631
46805
  showRowGuide(table, row, cell, startHeight);
46806
+ isRowResizingGlobal.active = true;
46807
+ window.getSelection()?.removeAllRanges();
46808
+ document.body.style.userSelect = "none";
46632
46809
  document.body.style.cursor = "row-resize";
46633
46810
  event.preventDefault();
46634
46811
  event.stopPropagation();
@@ -46670,6 +46847,8 @@ function useTableRowResize({
46670
46847
  editor.view.dispatch(tr);
46671
46848
  }
46672
46849
  stateRef.current = null;
46850
+ isRowResizingGlobal.active = false;
46851
+ document.body.style.userSelect = "";
46673
46852
  document.body.style.cursor = "";
46674
46853
  clearHoveredTableCell();
46675
46854
  clearAllTableResizeHover();
@@ -46678,6 +46857,8 @@ function useTableRowResize({
46678
46857
  const cancelResize = import_react78.default.useCallback(() => {
46679
46858
  if (!stateRef.current) return;
46680
46859
  stateRef.current = null;
46860
+ isRowResizingGlobal.active = false;
46861
+ document.body.style.userSelect = "";
46681
46862
  document.body.style.cursor = "";
46682
46863
  clearHoveredTableCell();
46683
46864
  clearAllTableResizeHover();
@@ -46685,6 +46866,8 @@ function useTableRowResize({
46685
46866
  }, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
46686
46867
  const cleanup = import_react78.default.useCallback(() => {
46687
46868
  stateRef.current = null;
46869
+ isRowResizingGlobal.active = false;
46870
+ document.body.style.userSelect = "";
46688
46871
  document.body.style.cursor = "";
46689
46872
  }, []);
46690
46873
  return {
@@ -46733,11 +46916,21 @@ function useUEditorTableInteractions(editor, editable = true) {
46733
46916
  guide.style.opacity = "0";
46734
46917
  }
46735
46918
  }, [getProseMirrorElement]);
46919
+ const hotspotTimerRef = (0, import_react79.useRef)(null);
46920
+ const activeHotspotKeyRef = (0, import_react79.useRef)(null);
46921
+ const clearHotspotTimer = import_react79.default.useCallback(() => {
46922
+ if (hotspotTimerRef.current !== null) {
46923
+ window.clearTimeout(hotspotTimerRef.current);
46924
+ hotspotTimerRef.current = null;
46925
+ }
46926
+ }, []);
46736
46927
  const clearAllTableResizeHover = import_react79.default.useCallback(() => {
46928
+ clearHotspotTimer();
46929
+ activeHotspotKeyRef.current = null;
46737
46930
  setEditorResizeCursor("");
46738
46931
  hideColumnGuide();
46739
46932
  hideRowGuide();
46740
- }, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
46933
+ }, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
46741
46934
  const updateActiveCellHighlight = import_react79.default.useCallback((cell) => {
46742
46935
  const surface = editorContentRef.current;
46743
46936
  const highlight = activeTableCellHighlightRef.current;
@@ -46876,6 +47069,10 @@ function useUEditorTableInteractions(editor, editable = true) {
46876
47069
  if (syncActiveRowResizeGuide()) {
46877
47070
  return;
46878
47071
  }
47072
+ if (event.buttons !== 0) {
47073
+ clearAllTableResizeHover();
47074
+ return;
47075
+ }
46879
47076
  const target = resolveEventElement(event.target);
46880
47077
  if (!(target instanceof Element)) {
46881
47078
  clearAllTableResizeHover();
@@ -46895,18 +47092,46 @@ function useUEditorTableInteractions(editor, editable = true) {
46895
47092
  clearAllTableResizeHover();
46896
47093
  return;
46897
47094
  }
46898
- const nearBottom = isRowResizeHotspot(cell, event.clientX, event.clientY);
46899
- const nearRight = isColumnResizeHotspot(cell, event.clientX, event.clientY);
46900
- if (nearBottom && cell instanceof HTMLTableCellElement) {
46901
- hideColumnGuide();
46902
- showRowGuide(table, row, cell);
47095
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
47096
+ const colTarget = resolveColumnResizeTarget(cell, event.clientX, event.clientY);
47097
+ if (rowTarget) {
47098
+ const hotspotKey = `row:${rowTarget.row.rowIndex}-${rowTarget.cell.cellIndex}`;
47099
+ if (activeHotspotKeyRef.current === hotspotKey) {
47100
+ hideColumnGuide();
47101
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
47102
+ return;
47103
+ }
47104
+ if (activeHotspotKeyRef.current !== hotspotKey) {
47105
+ clearHotspotTimer();
47106
+ activeHotspotKeyRef.current = hotspotKey;
47107
+ hotspotTimerRef.current = window.setTimeout(() => {
47108
+ hotspotTimerRef.current = null;
47109
+ hideColumnGuide();
47110
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
47111
+ }, 100);
47112
+ }
46903
47113
  return;
46904
47114
  }
46905
- if (nearRight && cell instanceof HTMLTableCellElement) {
46906
- hideRowGuide();
46907
- showColumnGuide(table, row, cell);
47115
+ if (colTarget) {
47116
+ const hotspotKey = `col:${colTarget.row.rowIndex}-${colTarget.cell.cellIndex}`;
47117
+ if (activeHotspotKeyRef.current === hotspotKey) {
47118
+ hideRowGuide();
47119
+ showColumnGuide(table, colTarget.row, colTarget.cell);
47120
+ return;
47121
+ }
47122
+ if (activeHotspotKeyRef.current !== hotspotKey) {
47123
+ clearHotspotTimer();
47124
+ activeHotspotKeyRef.current = hotspotKey;
47125
+ hotspotTimerRef.current = window.setTimeout(() => {
47126
+ hotspotTimerRef.current = null;
47127
+ hideRowGuide();
47128
+ showColumnGuide(table, colTarget.row, colTarget.cell);
47129
+ }, 100);
47130
+ }
46908
47131
  return;
46909
47132
  }
47133
+ clearHotspotTimer();
47134
+ activeHotspotKeyRef.current = null;
46910
47135
  clearAllTableResizeHover();
46911
47136
  };
46912
47137
  const handleEditorMouseLeave = () => {
@@ -46927,15 +47152,22 @@ function useUEditorTableInteractions(editor, editable = true) {
46927
47152
  clearActiveTableCell();
46928
47153
  return;
46929
47154
  }
46930
- setActiveTableCell(cell);
46931
- scheduleActiveCellSync(cell);
46932
47155
  const row = cell.closest("tr");
46933
47156
  const table = cell.closest("table");
46934
47157
  if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
46935
- if (beginResize(event, table, row, cell)) {
46936
- suppressActiveCellHighlightRef.current = true;
46937
- updateActiveCellHighlight(null);
47158
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
47159
+ if (rowTarget) {
47160
+ event.preventDefault();
47161
+ event.stopPropagation();
47162
+ window.getSelection()?.removeAllRanges();
47163
+ if (beginResize(event, table, rowTarget.row, rowTarget.cell)) {
47164
+ suppressActiveCellHighlightRef.current = true;
47165
+ updateActiveCellHighlight(null);
47166
+ return;
47167
+ }
46938
47168
  }
47169
+ setActiveTableCell(cell);
47170
+ scheduleActiveCellSync(cell);
46939
47171
  };
46940
47172
  const handlePointerMove = (event) => {
46941
47173
  handleRowResizePointerMove(event);
@@ -47024,8 +47256,9 @@ function useUEditorTableInteractions(editor, editable = true) {
47024
47256
  clearActiveTableCell();
47025
47257
  clearHoveredTableCell();
47026
47258
  clearAllTableResizeHover();
47259
+ clearHotspotTimer();
47027
47260
  };
47028
- }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
47261
+ }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHotspotTimer, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
47029
47262
  return {
47030
47263
  editorContentRef,
47031
47264
  tableColumnGuideRef,
@@ -47787,6 +48020,7 @@ var UEditor = import_react84.default.forwardRef(({
47787
48020
  variant = "default",
47788
48021
  rounded = true,
47789
48022
  fontFamilies,
48023
+ defaultFontFamily = "Inter",
47790
48024
  fontSizes,
47791
48025
  lineHeights,
47792
48026
  letterSpacings,
@@ -47811,6 +48045,10 @@ var UEditor = import_react84.default.forwardRef(({
47811
48045
  const formulaRangePickRef = (0, import_react84.useRef)(null);
47812
48046
  const formulaRangeSurfaceRef = (0, import_react84.useRef)(null);
47813
48047
  const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react84.default.useState(null);
48048
+ const [isMenuBarVisible, setIsMenuBarVisible] = import_react84.default.useState(showMenuBar);
48049
+ (0, import_react84.useEffect)(() => {
48050
+ setIsMenuBarVisible(showMenuBar);
48051
+ }, [showMenuBar]);
47814
48052
  const { flushOutputUpdates, scheduleOutputUpdate } = useUEditorOutput({
47815
48053
  onChange,
47816
48054
  onHtmlChange,
@@ -48069,7 +48307,7 @@ var UEditor = import_react84.default.forwardRef(({
48069
48307
  ),
48070
48308
  children: [
48071
48309
  editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(EditorUiRenderStateProvider, { editor, children: [
48072
- showMenuBar && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_react84.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
48310
+ isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_react84.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
48073
48311
  LazyMenuBar,
48074
48312
  {
48075
48313
  editor,
@@ -48090,11 +48328,14 @@ var UEditor = import_react84.default.forwardRef(({
48090
48328
  {
48091
48329
  editor,
48092
48330
  variant,
48331
+ isMenuBarVisible,
48332
+ onToggleMenuBar: () => setIsMenuBarVisible((visible) => !visible),
48093
48333
  uploadImage,
48094
48334
  imageInsertMode,
48095
48335
  maxImageFileSize,
48096
48336
  allowedImageMimeTypes,
48097
48337
  fontFamilies,
48338
+ defaultFontFamily,
48098
48339
  fontSizes,
48099
48340
  lineHeights,
48100
48341
  letterSpacings
@@ -48120,6 +48361,7 @@ var UEditor = import_react84.default.forwardRef(({
48120
48361
  },
48121
48362
  className: "relative flex-1 overflow-y-auto",
48122
48363
  style: {
48364
+ fontFamily: defaultFontFamily,
48123
48365
  minHeight: editable ? minHeight : void 0,
48124
48366
  maxHeight
48125
48367
  },
@@ -48129,7 +48371,7 @@ var UEditor = import_react84.default.forwardRef(({
48129
48371
  {
48130
48372
  ref: tableColumnGuideRef,
48131
48373
  "aria-hidden": "true",
48132
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
48374
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
48133
48375
  }
48134
48376
  ),
48135
48377
  /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
@@ -48137,7 +48379,7 @@ var UEditor = import_react84.default.forwardRef(({
48137
48379
  {
48138
48380
  ref: tableRowGuideRef,
48139
48381
  "aria-hidden": "true",
48140
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
48382
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
48141
48383
  }
48142
48384
  ),
48143
48385
  /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
@@ -48146,7 +48388,7 @@ var UEditor = import_react84.default.forwardRef(({
48146
48388
  ref: activeTableCellHighlightRef,
48147
48389
  "aria-hidden": "true",
48148
48390
  "data-ueditor-active-cell-highlight": "",
48149
- className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
48391
+ className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
48150
48392
  }
48151
48393
  ),
48152
48394
  /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(