@underverse-ui/underverse 2.0.11 → 2.0.13

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.
package/dist/ueditor.cjs CHANGED
@@ -5061,17 +5061,60 @@ function getSelectionTableCell(view) {
5061
5061
  const cell = element?.closest?.("th,td");
5062
5062
  return cell instanceof HTMLElement ? cell : null;
5063
5063
  }
5064
- function isRowResizeHotspot(cell, clientX, clientY) {
5064
+ function resolveRowResizeTarget(cell, clientX, clientY) {
5065
5065
  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;
5066
+ const row = cell.closest("tr");
5067
+ if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
5068
+ return null;
5069
+ }
5070
+ const distToBottom = Math.abs(clientY - rect.bottom);
5071
+ const distToTop = Math.abs(clientY - rect.top);
5072
+ const distToRight = Math.abs(clientX - rect.right);
5073
+ const distToLeft = Math.abs(clientX - rect.left);
5074
+ if (distToRight <= 3 || distToLeft <= 3) {
5075
+ return null;
5076
+ }
5077
+ if (distToBottom <= TABLE_RESIZE_HIT_ZONE) {
5078
+ return { row, cell };
5079
+ }
5080
+ if (distToTop <= TABLE_RESIZE_HIT_ZONE) {
5081
+ const prevRow = row.previousElementSibling;
5082
+ if (prevRow instanceof HTMLTableRowElement) {
5083
+ const cellIndex = cell.cellIndex;
5084
+ const prevCell = prevRow.children[cellIndex] ?? prevRow.firstElementChild;
5085
+ if (prevCell instanceof HTMLTableCellElement) {
5086
+ return { row: prevRow, cell: prevCell };
5087
+ }
5088
+ }
5089
+ }
5090
+ return null;
5069
5091
  }
5070
- function isColumnResizeHotspot(cell, clientX, clientY) {
5092
+ function resolveColumnResizeTarget(cell, clientX, clientY) {
5071
5093
  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;
5094
+ const row = cell.closest("tr");
5095
+ if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
5096
+ return null;
5097
+ }
5098
+ const distToRight = Math.abs(clientX - rect.right);
5099
+ const distToLeft = Math.abs(clientX - rect.left);
5100
+ const distToBottom = Math.abs(clientY - rect.bottom);
5101
+ const distToTop = Math.abs(clientY - rect.top);
5102
+ if (distToBottom <= 3 || distToTop <= 3) {
5103
+ return null;
5104
+ }
5105
+ if (distToRight <= TABLE_RESIZE_HIT_ZONE) {
5106
+ return { row, cell };
5107
+ }
5108
+ if (distToLeft <= TABLE_RESIZE_HIT_ZONE) {
5109
+ const prevCell = cell.previousElementSibling;
5110
+ if (prevCell instanceof HTMLTableCellElement) {
5111
+ return { row, cell: prevCell };
5112
+ }
5113
+ }
5114
+ return null;
5115
+ }
5116
+ function isRowResizeHotspot(cell, clientX, clientY) {
5117
+ return resolveRowResizeTarget(cell, clientX, clientY) !== null;
5075
5118
  }
5076
5119
  function getRelativeBoundaryMetrics(surface, table, row, cell) {
5077
5120
  const surfaceRect = surface.getBoundingClientRect();
@@ -5123,7 +5166,7 @@ function getRelativeSelectedCellsMetrics(surface) {
5123
5166
  height: bottom - top
5124
5167
  };
5125
5168
  }
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;
5169
+ 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
5170
  var init_table_dom_utils = __esm({
5128
5171
  "src/components/UEditor/table-dom-utils.ts"() {
5129
5172
  "use strict";
@@ -5131,8 +5174,9 @@ var init_table_dom_utils = __esm({
5131
5174
  MIN_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
5132
5175
  COLUMN_RESIZE_LINE_THICKNESS = 2;
5133
5176
  ROW_RESIZE_LINE_THICKNESS = 2;
5134
- UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor-table-layout-change";
5135
- TABLE_RESIZE_HIT_ZONE = 10;
5177
+ UEDITOR_TABLE_LAYOUT_CHANGE_EVENT = "ueditor:table-layout-change";
5178
+ isRowResizingGlobal = { active: false };
5179
+ TABLE_RESIZE_HIT_ZONE = 5;
5136
5180
  }
5137
5181
  });
5138
5182
 
@@ -6211,6 +6255,18 @@ var init_colors = __esm({
6211
6255
  const automaticColor = colors[0]?.color ?? "";
6212
6256
  const paletteColors = colors.slice(1);
6213
6257
  const customColorSelect = onCustomColorSelect ?? onSelect;
6258
+ const [hexInput, setHexInput] = import_react31.default.useState(currentColor.startsWith("#") ? currentColor : "");
6259
+ import_react31.default.useEffect(() => {
6260
+ setHexInput(currentColor.startsWith("#") ? currentColor : "");
6261
+ }, [currentColor]);
6262
+ const commitHex = (val) => {
6263
+ let formatted = val.trim();
6264
+ if (!formatted) return;
6265
+ if (!formatted.startsWith("#")) formatted = `#${formatted}`;
6266
+ if (/^#([0-9A-F]{3}){1,2}$/i.test(formatted)) {
6267
+ customColorSelect(formatted);
6268
+ }
6269
+ };
6214
6270
  import_react31.default.useEffect(() => {
6215
6271
  const input = colorInputRef.current;
6216
6272
  if (!input) return;
@@ -6222,7 +6278,7 @@ var init_colors = __esm({
6222
6278
  const input = colorInputRef.current;
6223
6279
  if (input) input.value = currentColor.startsWith("#") ? currentColor : "#000000";
6224
6280
  }, [currentColor]);
6225
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-56 p-2", children: [
6281
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-56 p-2", "data-ueditor-keep-open": true, children: [
6226
6282
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
6227
6283
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6228
6284
  "button",
@@ -6256,29 +6312,48 @@ var init_colors = __esm({
6256
6312
  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
6313
  }
6258
6314
  ) }, `${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%)"
6315
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mt-3 flex items-center gap-2", children: [
6316
+ /* @__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: [
6317
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6318
+ "span",
6319
+ {
6320
+ className: "h-4 w-4 shrink-0 rounded-[2px] border border-border",
6321
+ style: { backgroundColor: hexInput.startsWith("#") ? hexInput : currentColor.startsWith("#") ? currentColor : "transparent" }
6322
+ }
6323
+ ),
6324
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6325
+ "input",
6326
+ {
6327
+ type: "text",
6328
+ value: hexInput,
6329
+ onChange: (e) => setHexInput(e.target.value),
6330
+ onBlur: () => commitHex(hexInput),
6331
+ onMouseDown: (e) => e.stopPropagation(),
6332
+ onClick: (e) => e.stopPropagation(),
6333
+ onKeyDown: (e) => {
6334
+ e.stopPropagation();
6335
+ if (e.key === "Enter") {
6336
+ e.preventDefault();
6337
+ commitHex(hexInput);
6274
6338
  }
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
- ),
6339
+ },
6340
+ placeholder: "#HEX",
6341
+ className: "h-full w-full bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground"
6342
+ }
6343
+ )
6344
+ ] }),
6345
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6346
+ "button",
6347
+ {
6348
+ type: "button",
6349
+ onMouseDown: (e) => e.stopPropagation(),
6350
+ onClick: () => colorInputRef.current?.click(),
6351
+ title: t("colors.moreColors"),
6352
+ 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",
6353
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Palette, { className: "h-4 w-4 text-muted-foreground" })
6354
+ }
6355
+ )
6356
+ ] }),
6282
6357
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6283
6358
  "input",
6284
6359
  {
@@ -6852,7 +6927,7 @@ var init_toolbar = __esm({
6852
6927
  return button;
6853
6928
  });
6854
6929
  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)]" });
6930
+ 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
6931
  TableInsertGrid = ({
6857
6932
  insertLabel,
6858
6933
  previewTemplate,
@@ -6897,6 +6972,7 @@ var init_toolbar = __esm({
6897
6972
  maxImageFileSize = DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
6898
6973
  allowedImageMimeTypes = DEFAULT_UEDITOR_IMAGE_MIME_TYPES,
6899
6974
  fontFamilies,
6975
+ defaultFontFamily = "Inter",
6900
6976
  fontSizes,
6901
6977
  lineHeights,
6902
6978
  letterSpacings
@@ -6939,9 +7015,9 @@ var init_toolbar = __esm({
6939
7015
  const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
6940
7016
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
6941
7017
  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");
7018
+ const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
7019
+ const defaultFontFamilyValue = defaultFontFamilyOption?.value ?? defaultFontFamily ?? "Inter";
7020
+ const displayedFontFamilyLabel = currentFontFamily ? currentFontFamilyLabel : defaultFontFamilyOption?.label ?? defaultFontFamily ?? t("toolbar.fontDefault");
6945
7021
  const displayedFontFamilyValue = currentFontFamily || defaultFontFamilyValue;
6946
7022
  const displayedFontSizeLabel = currentFontSize ? currentFontSizeLabel : "13";
6947
7023
  const activeFontSize = currentFontSize || "13px";
@@ -7073,7 +7149,7 @@ var init_toolbar = __esm({
7073
7149
  "div",
7074
7150
  {
7075
7151
  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",
7152
+ className: "flex min-h-9 flex-nowrap items-center gap-0.5 overflow-x-auto border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-1.5 py-1 dark:bg-muted/60",
7077
7153
  children: [
7078
7154
  isFull && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7079
7155
  DropdownMenu,
@@ -7084,9 +7160,9 @@ var init_toolbar = __esm({
7084
7160
  onClick: () => {
7085
7161
  },
7086
7162
  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",
7163
+ 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
7164
  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 }),
7165
+ /* @__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
7166
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7091
7167
  ]
7092
7168
  }
@@ -7113,9 +7189,9 @@ var init_toolbar = __esm({
7113
7189
  onClick: () => {
7114
7190
  },
7115
7191
  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",
7192
+ 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
7193
  children: [
7118
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-sm font-normal leading-none", children: displayedFontSizeLabel }),
7194
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
7119
7195
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7120
7196
  ]
7121
7197
  }
@@ -7240,6 +7316,27 @@ var init_toolbar = __esm({
7240
7316
  )
7241
7317
  ] }),
7242
7318
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarDivider, {}),
7319
+ (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7320
+ DropdownMenu,
7321
+ {
7322
+ isOpen: isTableMenuOpen,
7323
+ onOpenChange: setIsTableMenuOpen,
7324
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarButton, { onClick: () => {
7325
+ }, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
7326
+ contentClassName: "p-2 min-w-56",
7327
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7328
+ TableInsertGrid,
7329
+ {
7330
+ insertLabel: t("tableMenu.insertTable"),
7331
+ previewTemplate: t("tableMenu.gridPreview"),
7332
+ onInsert: (rows, cols) => {
7333
+ editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
7334
+ setIsTableMenuOpen(false);
7335
+ }
7336
+ }
7337
+ )
7338
+ }
7339
+ ),
7243
7340
  /* @__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
7341
  /* @__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
7342
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -7710,27 +7807,6 @@ var init_toolbar = __esm({
7710
7807
  ] })
7711
7808
  }
7712
7809
  ),
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
7810
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolbarDivider, {}),
7735
7811
  /* @__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
7812
  /* @__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" }) }),
@@ -7929,7 +8005,7 @@ var init_editor_styles = __esm({
7929
8005
  "[&_.selectedCell]:after:absolute",
7930
8006
  "[&_.selectedCell]:after:inset-0",
7931
8007
  "[&_.selectedCell]:after:z-[2]",
7932
- "[&_.selectedCell]:after:bg-primary/15",
8008
+ "[&_.selectedCell]:after:bg-primary/8",
7933
8009
  "[&_.selectedCell]:after:pointer-events-none",
7934
8010
  "[&_.column-resize-handle]:pointer-events-auto",
7935
8011
  "[&_.column-resize-handle]:cursor-col-resize",
@@ -7943,17 +8019,10 @@ var init_editor_styles = __esm({
7943
8019
  "[&_.column-resize-handle]:rounded-none",
7944
8020
  "[&_.column-resize-handle]:opacity-0",
7945
8021
  "[&_.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",
8022
+ "[&_.column-resize-handle]:duration-200",
8023
+ "[&_.column-resize-handle]:delay-100",
8024
+ "[&_.column-resize-handle]:ease-out",
8025
+ "[&_.column-resize-handle]:after:hidden",
7957
8026
  "[&_.column-resize-dragging]:min-w-0",
7958
8027
  "[&.resize-cursor]:cursor-col-resize",
7959
8028
  "[&.resize-row-cursor]:cursor-row-resize",
@@ -8825,7 +8894,8 @@ var init_menu_bar = __esm({
8825
8894
  onSave,
8826
8895
  onExport,
8827
8896
  onSourceCode,
8828
- onPreview
8897
+ onPreview,
8898
+ showPreviewButton = true
8829
8899
  }) => {
8830
8900
  const t = useSmartTranslations("UEditor");
8831
8901
  useSharedEditorUiRenderState(editor);
@@ -9034,7 +9104,7 @@ var init_menu_bar = __esm({
9034
9104
  },
9035
9105
  key
9036
9106
  )),
9037
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
9107
+ showPreviewButton && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
9038
9108
  "button",
9039
9109
  {
9040
9110
  type: "button",
@@ -12115,6 +12185,15 @@ function edgeCell(view, event, side, handleWidth) {
12115
12185
  const index = map.map.indexOf($cell.pos - start);
12116
12186
  return index % map.width === 0 ? -1 : start + map.map[index - 1];
12117
12187
  }
12188
+ var handleHoverTimer = null;
12189
+ var pendingHandleCell = -1;
12190
+ function clearHandleHoverTimer() {
12191
+ if (handleHoverTimer !== null) {
12192
+ window.clearTimeout(handleHoverTimer);
12193
+ handleHoverTimer = null;
12194
+ }
12195
+ pendingHandleCell = -1;
12196
+ }
12118
12197
  function updateHandle(view, value) {
12119
12198
  view.dispatch(view.state.tr.setMeta(import_tables2.columnResizingPluginKey, { setHandle: value }));
12120
12199
  }
@@ -12129,19 +12208,43 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
12129
12208
  if (event.clientX - left <= handleWidth) cell = edgeCell(view, event, "left", handleWidth);
12130
12209
  else if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, "right", handleWidth);
12131
12210
  }
12132
- if (cell === pluginState.activeHandle) return;
12133
- if (!lastColumnResizable && cell !== -1) {
12211
+ if (cell === pluginState.activeHandle) {
12212
+ clearHandleHoverTimer();
12213
+ return;
12214
+ }
12215
+ if (cell === -1) {
12216
+ clearHandleHoverTimer();
12217
+ if (pluginState.activeHandle !== -1) {
12218
+ updateHandle(view, -1);
12219
+ }
12220
+ return;
12221
+ }
12222
+ if (!lastColumnResizable) {
12134
12223
  const $cell = view.state.doc.resolve(cell);
12135
12224
  const table = $cell.node(-1);
12136
12225
  const map = import_tables2.TableMap.get(table);
12137
12226
  const tableStart = $cell.start(-1);
12138
12227
  const nodeAfter = $cell.nodeAfter;
12139
12228
  if (!nodeAfter) return;
12140
- if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) return;
12229
+ if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) {
12230
+ clearHandleHoverTimer();
12231
+ if (pluginState.activeHandle !== -1) {
12232
+ updateHandle(view, -1);
12233
+ }
12234
+ return;
12235
+ }
12141
12236
  }
12142
- updateHandle(view, cell);
12237
+ if (pendingHandleCell === cell) return;
12238
+ clearHandleHoverTimer();
12239
+ pendingHandleCell = cell;
12240
+ handleHoverTimer = window.setTimeout(() => {
12241
+ handleHoverTimer = null;
12242
+ pendingHandleCell = -1;
12243
+ updateHandle(view, cell);
12244
+ }, 100);
12143
12245
  }
12144
12246
  function handleMouseLeave(view) {
12247
+ clearHandleHoverTimer();
12145
12248
  if (!view.editable) return;
12146
12249
  const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
12147
12250
  if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) {
@@ -12190,7 +12293,7 @@ function getColumnResizeGhost(view) {
12190
12293
  ghost.style.pointerEvents = "none";
12191
12294
  ghost.style.width = "2px";
12192
12295
  ghost.style.backgroundColor = "var(--primary, #2563eb)";
12193
- ghost.style.opacity = "1";
12296
+ ghost.style.opacity = "0.5";
12194
12297
  ghost.style.borderRadius = "9999px";
12195
12298
  ghost.style.boxShadow = "0 0 0 1px color-mix(in oklch, var(--background, #fff) 80%, transparent)";
12196
12299
  ghost.style.transform = "translateX(-1px)";
@@ -12219,6 +12322,7 @@ function showColumnResizeGhost(view, cell, dragging, width) {
12219
12322
  ghost.style.height = `${rect.height}px`;
12220
12323
  }
12221
12324
  function handleMouseDown(view, event, cellMinWidth) {
12325
+ clearHandleHoverTimer();
12222
12326
  if (!view.editable) return false;
12223
12327
  const win = view.dom.ownerDocument.defaultView ?? window;
12224
12328
  const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
@@ -12340,6 +12444,7 @@ function dynamicColumnResizing({
12340
12444
 
12341
12445
  // src/components/UEditor/table-align.ts
12342
12446
  init_table_align_utils();
12447
+ init_table_dom_utils();
12343
12448
  function normalizeTableAlign(value) {
12344
12449
  if (value === "left" || value === "center" || value === "right") {
12345
12450
  return value;
@@ -12466,6 +12571,38 @@ var UEditorTable = import_extension_table.Table.extend({
12466
12571
  lastColumnResizable: this.options.lastColumnResizable
12467
12572
  })
12468
12573
  ] : [],
12574
+ new import_state7.Plugin({
12575
+ key: new import_state7.PluginKey("tableRowResizeInterceptor"),
12576
+ props: {
12577
+ handleDOMEvents: {
12578
+ mousedown(view, event) {
12579
+ if (event.button !== 0) return false;
12580
+ const target = resolveEventElement(event.target);
12581
+ const cell = target?.closest("th,td");
12582
+ if (cell instanceof HTMLElement && isRowResizeHotspot(cell, event.clientX, event.clientY)) {
12583
+ isRowResizingGlobal.active = true;
12584
+ return true;
12585
+ }
12586
+ return false;
12587
+ },
12588
+ mousemove(_view, event) {
12589
+ if (isRowResizingGlobal.active) {
12590
+ if (event.buttons === 0) {
12591
+ isRowResizingGlobal.active = false;
12592
+ return false;
12593
+ }
12594
+ event.preventDefault();
12595
+ return true;
12596
+ }
12597
+ return false;
12598
+ },
12599
+ mouseup() {
12600
+ isRowResizingGlobal.active = false;
12601
+ return false;
12602
+ }
12603
+ }
12604
+ }
12605
+ }),
12469
12606
  (0, import_tables3.tableEditing)({
12470
12607
  allowTableNodeSelection: this.options.allowTableNodeSelection
12471
12608
  }),
@@ -14314,8 +14451,11 @@ function buildUEditorExtensions({
14314
14451
  placeholder,
14315
14452
  emptyEditorClass: "is-editor-empty",
14316
14453
  emptyNodeClass: "is-empty",
14317
- shouldShow: ({ node, hasTable }) => {
14454
+ shouldShow: ({ editor, node, hasTable, isEmptyDoc }) => {
14318
14455
  const nodeName = node.type.name;
14456
+ if (!isEmptyDoc || editor.state.doc.childCount !== 1) {
14457
+ return false;
14458
+ }
14319
14459
  if (nodeName === "table" || nodeName === "tableCell" || nodeName === "tableHeader") {
14320
14460
  return false;
14321
14461
  }
@@ -15622,7 +15762,11 @@ var CustomBubbleMenu = ({
15622
15762
  setIsVisible(false);
15623
15763
  return;
15624
15764
  }
15625
- if (!keepOpenRef.current && (context2 === "none" || !view.hasFocus())) {
15765
+ const isInputFocused = () => {
15766
+ const active = document.activeElement;
15767
+ return Boolean(active && (menuRef.current?.contains(active) || active.closest?.("[data-ueditor-keep-open]")));
15768
+ };
15769
+ if (!keepOpenRef.current && !isInputFocused() && (context2 === "none" || !view.hasFocus())) {
15626
15770
  clearShowTimeout();
15627
15771
  setIsVisible(false);
15628
15772
  return;
@@ -15663,7 +15807,8 @@ var CustomBubbleMenu = ({
15663
15807
  }, SHOW_DELAY_MS);
15664
15808
  };
15665
15809
  const handleBlur = () => {
15666
- if (!keepOpenRef.current) {
15810
+ const isInputFocused = Boolean(document.activeElement && (menuRef.current?.contains(document.activeElement) || document.activeElement.closest?.("[data-ueditor-keep-open]")));
15811
+ if (!keepOpenRef.current && !isInputFocused) {
15667
15812
  clearShowTimeout();
15668
15813
  setIsVisible(false);
15669
15814
  }
@@ -15757,6 +15902,9 @@ var CustomBubbleMenu = ({
15757
15902
  } else if (target?.closest?.("[data-ueditor-keep-open]")) {
15758
15903
  setKeepOpen(true);
15759
15904
  }
15905
+ if (target && target.closest("input, textarea, select")) {
15906
+ return;
15907
+ }
15760
15908
  e.preventDefault();
15761
15909
  },
15762
15910
  children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -19330,7 +19478,7 @@ function createKey(name) {
19330
19478
  keys[name] = 0;
19331
19479
  return name + "$";
19332
19480
  }
19333
- var PluginKey6 = class {
19481
+ var PluginKey7 = class {
19334
19482
  /**
19335
19483
  Create a plugin key.
19336
19484
  */
@@ -19762,7 +19910,7 @@ function tableNodeTypes2(schema) {
19762
19910
  }
19763
19911
  return result;
19764
19912
  }
19765
- var tableEditingKey = new PluginKey6("selectingCells");
19913
+ var tableEditingKey = new PluginKey7("selectingCells");
19766
19914
  function cellAround2($pos) {
19767
19915
  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));
19768
19916
  return null;
@@ -19993,7 +20141,7 @@ var CellBookmark = class CellBookmark2 {
19993
20141
  else return Selection.near($headCell, 1);
19994
20142
  }
19995
20143
  };
19996
- var fixTablesKey = new PluginKey6("fix-tables");
20144
+ var fixTablesKey = new PluginKey7("fix-tables");
19997
20145
  function convertTableNodeToArrayOfRows(tableNode) {
19998
20146
  const map = TableMap4.get(tableNode);
19999
20147
  const rows = [];
@@ -20471,7 +20619,7 @@ function atEndOfCell(view, axis, dir) {
20471
20619
  }
20472
20620
  return null;
20473
20621
  }
20474
- var columnResizingPluginKey2 = new PluginKey6("tableColumnResizing");
20622
+ var columnResizingPluginKey2 = new PluginKey7("tableColumnResizing");
20475
20623
 
20476
20624
  // src/components/UEditor/table-controls.tsx
20477
20625
  var import_lucide_react18 = require("lucide-react");
@@ -20920,6 +21068,8 @@ init_Tooltip();
20920
21068
  var import_jsx_runtime29 = require("react/jsx-runtime");
20921
21069
  var ADD_COLUMN_RAIL_GAP = 4;
20922
21070
  var ADD_ROW_RAIL_GAP = 4;
21071
+ var BUTTON_LONG_SIZE = 36;
21072
+ var BUTTON_SHORT_SIZE = 14;
20923
21073
  function TableAddRails({
20924
21074
  addColumnVisible,
20925
21075
  addRowVisible,
@@ -20932,10 +21082,10 @@ function TableAddRails({
20932
21082
  quickAddRowLabel
20933
21083
  }) {
20934
21084
  const visibleBounds = getVisibleTableBounds(layout);
20935
- const columnRailTop = visibleBounds.top;
21085
+ const columnRailTop = visibleBounds.top + Math.max(0, (visibleBounds.height - BUTTON_LONG_SIZE) / 2);
20936
21086
  const columnRailLeft = visibleBounds.right + ADD_COLUMN_RAIL_GAP;
20937
21087
  const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
20938
- const rowRailLeft = visibleBounds.left;
21088
+ const rowRailLeft = visibleBounds.left + Math.max(0, (visibleBounds.width - BUTTON_LONG_SIZE) / 2);
20939
21089
  const showColumnRail = controlsVisible || addColumnVisible;
20940
21090
  const showRowRail = controlsVisible || addRowVisible;
20941
21091
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
@@ -20960,15 +21110,15 @@ function TableAddRails({
20960
21110
  className: cn(
20961
21111
  "absolute z-30 inline-flex items-center justify-center rounded-md",
20962
21112
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
20963
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
21113
+ "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"
20964
21114
  ),
20965
21115
  style: {
20966
- top: showColumnRail ? columnRailTop : columnRailTop + Math.max(0, visibleBounds.height / 2 - 24),
21116
+ top: columnRailTop,
20967
21117
  left: columnRailLeft,
20968
- width: showColumnRail ? 18 : 12,
20969
- height: showColumnRail ? visibleBounds.height : 48,
21118
+ width: BUTTON_SHORT_SIZE,
21119
+ height: BUTTON_LONG_SIZE,
20970
21120
  opacity: showColumnRail ? 1 : 0,
20971
- transform: showColumnRail ? "scale(1)" : "scale(0.92)",
21121
+ transform: showColumnRail ? "scale(1)" : "scale(0.85)",
20972
21122
  pointerEvents: showColumnRail ? "auto" : "none"
20973
21123
  },
20974
21124
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -20997,15 +21147,15 @@ function TableAddRails({
20997
21147
  className: cn(
20998
21148
  "absolute z-30 inline-flex items-center justify-center rounded-md",
20999
21149
  "border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
21000
- "transition-[opacity,transform,colors] duration-150 hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
21150
+ "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"
21001
21151
  ),
21002
21152
  style: {
21003
21153
  top: rowRailTop,
21004
- left: showRowRail ? rowRailLeft : rowRailLeft + Math.max(0, visibleBounds.width / 2 - 24),
21005
- width: showRowRail ? visibleBounds.width : 48,
21006
- height: showRowRail ? 16 : 12,
21154
+ left: rowRailLeft,
21155
+ width: BUTTON_LONG_SIZE,
21156
+ height: BUTTON_SHORT_SIZE,
21007
21157
  opacity: showRowRail ? 1 : 0,
21008
- transform: showRowRail ? "scale(1)" : "scale(0.92)",
21158
+ transform: showRowRail ? "scale(1)" : "scale(0.85)",
21009
21159
  pointerEvents: showRowRail ? "auto" : "none"
21010
21160
  },
21011
21161
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
@@ -21142,7 +21292,7 @@ function TableRowHandles({
21142
21292
  onStartDrag(rowHandle);
21143
21293
  },
21144
21294
  className: cn(
21145
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
21295
+ "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",
21146
21296
  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"
21147
21297
  ),
21148
21298
  style: {
@@ -21217,7 +21367,7 @@ function TableColumnHandles({
21217
21367
  onStartDrag(columnHandle);
21218
21368
  },
21219
21369
  className: cn(
21220
- "inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-150",
21370
+ "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",
21221
21371
  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"
21222
21372
  ),
21223
21373
  style: {
@@ -21606,7 +21756,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
21606
21756
  const updateHoverState = import_react37.default.useCallback((event) => {
21607
21757
  const activeLayout = layoutRef.current;
21608
21758
  const surface = containerRef.current;
21609
- if (!activeLayout || !surface || dragStateRef.current) {
21759
+ if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
21610
21760
  setHoverState(DEFAULT_TABLE_HOVER_STATE);
21611
21761
  return;
21612
21762
  }
@@ -21740,7 +21890,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
21740
21890
  return result;
21741
21891
  }, [editor, scheduleSyncFromSelection]);
21742
21892
  const canExpandTable = Boolean(layout);
21743
- const controlsVisible = dragPreview !== null;
21893
+ const controlsVisible = false;
21744
21894
  const tableMenuOpen = openMenuKey === "table";
21745
21895
  const startTableResize = import_react37.default.useCallback((event) => {
21746
21896
  if (event.button !== 0 || dragStateRef.current) return;
@@ -22267,6 +22417,9 @@ function useTableRowResize({
22267
22417
  pendingHeight: startHeight
22268
22418
  };
22269
22419
  showRowGuide(table, row, cell, startHeight);
22420
+ isRowResizingGlobal.active = true;
22421
+ window.getSelection()?.removeAllRanges();
22422
+ document.body.style.userSelect = "none";
22270
22423
  document.body.style.cursor = "row-resize";
22271
22424
  event.preventDefault();
22272
22425
  event.stopPropagation();
@@ -22308,6 +22461,8 @@ function useTableRowResize({
22308
22461
  editor.view.dispatch(tr);
22309
22462
  }
22310
22463
  stateRef.current = null;
22464
+ isRowResizingGlobal.active = false;
22465
+ document.body.style.userSelect = "";
22311
22466
  document.body.style.cursor = "";
22312
22467
  clearHoveredTableCell();
22313
22468
  clearAllTableResizeHover();
@@ -22316,6 +22471,8 @@ function useTableRowResize({
22316
22471
  const cancelResize = import_react38.default.useCallback(() => {
22317
22472
  if (!stateRef.current) return;
22318
22473
  stateRef.current = null;
22474
+ isRowResizingGlobal.active = false;
22475
+ document.body.style.userSelect = "";
22319
22476
  document.body.style.cursor = "";
22320
22477
  clearHoveredTableCell();
22321
22478
  clearAllTableResizeHover();
@@ -22323,6 +22480,8 @@ function useTableRowResize({
22323
22480
  }, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
22324
22481
  const cleanup = import_react38.default.useCallback(() => {
22325
22482
  stateRef.current = null;
22483
+ isRowResizingGlobal.active = false;
22484
+ document.body.style.userSelect = "";
22326
22485
  document.body.style.cursor = "";
22327
22486
  }, []);
22328
22487
  return {
@@ -22371,11 +22530,21 @@ function useUEditorTableInteractions(editor, editable = true) {
22371
22530
  guide.style.opacity = "0";
22372
22531
  }
22373
22532
  }, [getProseMirrorElement]);
22533
+ const hotspotTimerRef = (0, import_react39.useRef)(null);
22534
+ const activeHotspotKeyRef = (0, import_react39.useRef)(null);
22535
+ const clearHotspotTimer = import_react39.default.useCallback(() => {
22536
+ if (hotspotTimerRef.current !== null) {
22537
+ window.clearTimeout(hotspotTimerRef.current);
22538
+ hotspotTimerRef.current = null;
22539
+ }
22540
+ }, []);
22374
22541
  const clearAllTableResizeHover = import_react39.default.useCallback(() => {
22542
+ clearHotspotTimer();
22543
+ activeHotspotKeyRef.current = null;
22375
22544
  setEditorResizeCursor("");
22376
22545
  hideColumnGuide();
22377
22546
  hideRowGuide();
22378
- }, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
22547
+ }, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
22379
22548
  const updateActiveCellHighlight = import_react39.default.useCallback((cell) => {
22380
22549
  const surface = editorContentRef.current;
22381
22550
  const highlight = activeTableCellHighlightRef.current;
@@ -22514,6 +22683,10 @@ function useUEditorTableInteractions(editor, editable = true) {
22514
22683
  if (syncActiveRowResizeGuide()) {
22515
22684
  return;
22516
22685
  }
22686
+ if (event.buttons !== 0) {
22687
+ clearAllTableResizeHover();
22688
+ return;
22689
+ }
22517
22690
  const target = resolveEventElement(event.target);
22518
22691
  if (!(target instanceof Element)) {
22519
22692
  clearAllTableResizeHover();
@@ -22533,18 +22706,46 @@ function useUEditorTableInteractions(editor, editable = true) {
22533
22706
  clearAllTableResizeHover();
22534
22707
  return;
22535
22708
  }
22536
- const nearBottom = isRowResizeHotspot(cell, event.clientX, event.clientY);
22537
- const nearRight = isColumnResizeHotspot(cell, event.clientX, event.clientY);
22538
- if (nearBottom && cell instanceof HTMLTableCellElement) {
22539
- hideColumnGuide();
22540
- showRowGuide(table, row, cell);
22709
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
22710
+ const colTarget = resolveColumnResizeTarget(cell, event.clientX, event.clientY);
22711
+ if (rowTarget) {
22712
+ const hotspotKey = `row:${rowTarget.row.rowIndex}-${rowTarget.cell.cellIndex}`;
22713
+ if (activeHotspotKeyRef.current === hotspotKey) {
22714
+ hideColumnGuide();
22715
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
22716
+ return;
22717
+ }
22718
+ if (activeHotspotKeyRef.current !== hotspotKey) {
22719
+ clearHotspotTimer();
22720
+ activeHotspotKeyRef.current = hotspotKey;
22721
+ hotspotTimerRef.current = window.setTimeout(() => {
22722
+ hotspotTimerRef.current = null;
22723
+ hideColumnGuide();
22724
+ showRowGuide(table, rowTarget.row, rowTarget.cell);
22725
+ }, 100);
22726
+ }
22541
22727
  return;
22542
22728
  }
22543
- if (nearRight && cell instanceof HTMLTableCellElement) {
22544
- hideRowGuide();
22545
- showColumnGuide(table, row, cell);
22729
+ if (colTarget) {
22730
+ const hotspotKey = `col:${colTarget.row.rowIndex}-${colTarget.cell.cellIndex}`;
22731
+ if (activeHotspotKeyRef.current === hotspotKey) {
22732
+ hideRowGuide();
22733
+ showColumnGuide(table, colTarget.row, colTarget.cell);
22734
+ return;
22735
+ }
22736
+ if (activeHotspotKeyRef.current !== hotspotKey) {
22737
+ clearHotspotTimer();
22738
+ activeHotspotKeyRef.current = hotspotKey;
22739
+ hotspotTimerRef.current = window.setTimeout(() => {
22740
+ hotspotTimerRef.current = null;
22741
+ hideRowGuide();
22742
+ showColumnGuide(table, colTarget.row, colTarget.cell);
22743
+ }, 100);
22744
+ }
22546
22745
  return;
22547
22746
  }
22747
+ clearHotspotTimer();
22748
+ activeHotspotKeyRef.current = null;
22548
22749
  clearAllTableResizeHover();
22549
22750
  };
22550
22751
  const handleEditorMouseLeave = () => {
@@ -22565,15 +22766,22 @@ function useUEditorTableInteractions(editor, editable = true) {
22565
22766
  clearActiveTableCell();
22566
22767
  return;
22567
22768
  }
22568
- setActiveTableCell(cell);
22569
- scheduleActiveCellSync(cell);
22570
22769
  const row = cell.closest("tr");
22571
22770
  const table = cell.closest("table");
22572
22771
  if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
22573
- if (beginResize(event, table, row, cell)) {
22574
- suppressActiveCellHighlightRef.current = true;
22575
- updateActiveCellHighlight(null);
22772
+ const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
22773
+ if (rowTarget) {
22774
+ event.preventDefault();
22775
+ event.stopPropagation();
22776
+ window.getSelection()?.removeAllRanges();
22777
+ if (beginResize(event, table, rowTarget.row, rowTarget.cell)) {
22778
+ suppressActiveCellHighlightRef.current = true;
22779
+ updateActiveCellHighlight(null);
22780
+ return;
22781
+ }
22576
22782
  }
22783
+ setActiveTableCell(cell);
22784
+ scheduleActiveCellSync(cell);
22577
22785
  };
22578
22786
  const handlePointerMove = (event) => {
22579
22787
  handleRowResizePointerMove(event);
@@ -22662,8 +22870,9 @@ function useUEditorTableInteractions(editor, editable = true) {
22662
22870
  clearActiveTableCell();
22663
22871
  clearHoveredTableCell();
22664
22872
  clearAllTableResizeHover();
22873
+ clearHotspotTimer();
22665
22874
  };
22666
- }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
22875
+ }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHotspotTimer, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
22667
22876
  return {
22668
22877
  editorContentRef,
22669
22878
  tableColumnGuideRef,
@@ -23425,6 +23634,7 @@ var UEditor = import_react44.default.forwardRef(({
23425
23634
  variant = "default",
23426
23635
  rounded = true,
23427
23636
  fontFamilies,
23637
+ defaultFontFamily = "Inter",
23428
23638
  fontSizes,
23429
23639
  lineHeights,
23430
23640
  letterSpacings,
@@ -23433,6 +23643,7 @@ var UEditor = import_react44.default.forwardRef(({
23433
23643
  uploadFileForSave,
23434
23644
  extraExtensions,
23435
23645
  showMenuBar = false,
23646
+ showPreviewButton = true,
23436
23647
  onSave,
23437
23648
  onExport,
23438
23649
  onSourceCode,
@@ -23718,7 +23929,8 @@ var UEditor = import_react44.default.forwardRef(({
23718
23929
  onSave,
23719
23930
  onExport,
23720
23931
  onSourceCode,
23721
- onPreview
23932
+ onPreview,
23933
+ showPreviewButton
23722
23934
  }
23723
23935
  ) }),
23724
23936
  showToolbar && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -23731,6 +23943,7 @@ var UEditor = import_react44.default.forwardRef(({
23731
23943
  maxImageFileSize,
23732
23944
  allowedImageMimeTypes,
23733
23945
  fontFamilies,
23946
+ defaultFontFamily,
23734
23947
  fontSizes,
23735
23948
  lineHeights,
23736
23949
  letterSpacings
@@ -23756,6 +23969,7 @@ var UEditor = import_react44.default.forwardRef(({
23756
23969
  },
23757
23970
  className: "relative flex-1 overflow-y-auto",
23758
23971
  style: {
23972
+ fontFamily: defaultFontFamily,
23759
23973
  minHeight: editable ? minHeight : void 0,
23760
23974
  maxHeight
23761
23975
  },
@@ -23765,7 +23979,7 @@ var UEditor = import_react44.default.forwardRef(({
23765
23979
  {
23766
23980
  ref: tableColumnGuideRef,
23767
23981
  "aria-hidden": "true",
23768
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
23982
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
23769
23983
  }
23770
23984
  ),
23771
23985
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -23773,7 +23987,7 @@ var UEditor = import_react44.default.forwardRef(({
23773
23987
  {
23774
23988
  ref: tableRowGuideRef,
23775
23989
  "aria-hidden": "true",
23776
- className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
23990
+ className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
23777
23991
  }
23778
23992
  ),
23779
23993
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -23782,7 +23996,7 @@ var UEditor = import_react44.default.forwardRef(({
23782
23996
  ref: activeTableCellHighlightRef,
23783
23997
  "aria-hidden": "true",
23784
23998
  "data-ueditor-active-cell-highlight": "",
23785
- className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
23999
+ className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
23786
24000
  }
23787
24001
  ),
23788
24002
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(