@underverse-ui/underverse 1.0.143 → 1.0.144

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.143",
3
+ "version": "1.0.144",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 232,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -25896,6 +25896,45 @@ function getImageFiles(dataTransfer) {
25896
25896
  }
25897
25897
  return Array.from(byKey.values());
25898
25898
  }
25899
+ function getClipboardData(dataTransfer, type) {
25900
+ try {
25901
+ return dataTransfer.getData(type) ?? "";
25902
+ } catch {
25903
+ return "";
25904
+ }
25905
+ }
25906
+ function extractClipboardHtmlFragment(html) {
25907
+ const startMarker = "<!--StartFragment-->";
25908
+ const endMarker = "<!--EndFragment-->";
25909
+ const start = html.indexOf(startMarker);
25910
+ const end = html.indexOf(endMarker);
25911
+ if (start >= 0 && end > start) {
25912
+ return html.slice(start + startMarker.length, end);
25913
+ }
25914
+ return html;
25915
+ }
25916
+ function getClipboardTableHtml(dataTransfer) {
25917
+ const html = getClipboardData(dataTransfer, "text/html");
25918
+ if (!/<table(?:\s|>)/i.test(html)) return "";
25919
+ const fragment = extractClipboardHtmlFragment(html);
25920
+ if (typeof DOMParser !== "undefined") {
25921
+ const doc = new DOMParser().parseFromString(fragment, "text/html");
25922
+ const table = doc.querySelector("table");
25923
+ if (table) return table.outerHTML;
25924
+ }
25925
+ return fragment;
25926
+ }
25927
+ function escapeHtml(value) {
25928
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
25929
+ }
25930
+ function getClipboardTsvTableHtml(dataTransfer) {
25931
+ const text = getClipboardData(dataTransfer, "text/plain").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n+$/, "");
25932
+ if (!text.includes(" ")) return "";
25933
+ const rows = text.split("\n").map((row) => row.split(" "));
25934
+ if (rows.length === 0 || rows.every((row) => row.length < 2)) return "";
25935
+ const body = rows.map((row) => `<tr>${row.map((cell) => `<td>${escapeHtml(cell)}</td>`).join("")}</tr>`).join("");
25936
+ return `<table><tbody>${body}</tbody></table>`;
25937
+ }
25899
25938
  function fileToDataUrl(file) {
25900
25939
  return new Promise((resolve, reject) => {
25901
25940
  const reader = new FileReader();
@@ -25950,6 +25989,18 @@ var ClipboardImages = import_core5.Extension.create({
25950
25989
  props: {
25951
25990
  handlePaste: (_view, event) => {
25952
25991
  if (!event || !event.clipboardData) return false;
25992
+ const tableHtml = getClipboardTableHtml(event.clipboardData);
25993
+ if (tableHtml) {
25994
+ event.preventDefault();
25995
+ editor.chain().focus().insertContent(tableHtml).run();
25996
+ return true;
25997
+ }
25998
+ const tsvTableHtml = getClipboardTsvTableHtml(event.clipboardData);
25999
+ if (tsvTableHtml) {
26000
+ event.preventDefault();
26001
+ editor.chain().focus().insertContent(tsvTableHtml).run();
26002
+ return true;
26003
+ }
25953
26004
  const files = getImageFiles(event.clipboardData);
25954
26005
  if (files.length === 0) return false;
25955
26006
  event.preventDefault();
@@ -29080,58 +29131,6 @@ var import_tables2 = require("@tiptap/pm/tables");
29080
29131
  var import_react_dom8 = require("react-dom");
29081
29132
  var import_lucide_react49 = require("lucide-react");
29082
29133
  var import_jsx_runtime86 = require("react/jsx-runtime");
29083
- var FloatingSlashCommandMenu = ({ editor, onClose }) => {
29084
- const t = useSmartTranslations("UEditor");
29085
- const messages = (0, import_react62.useMemo)(() => buildSlashCommandMessages(t), [t]);
29086
- const items = (0, import_react62.useMemo)(() => buildSlashCommandItems({ query: "", messages }), [messages]);
29087
- const listRef = (0, import_react62.useRef)(null);
29088
- (0, import_react62.useEffect)(() => {
29089
- const handleKeyDown2 = (event) => {
29090
- if (event.key === "Escape") {
29091
- event.preventDefault();
29092
- onClose();
29093
- return;
29094
- }
29095
- const handled = listRef.current?.onKeyDown({ event }) ?? false;
29096
- if (handled) {
29097
- event.preventDefault();
29098
- }
29099
- };
29100
- document.addEventListener("keydown", handleKeyDown2);
29101
- return () => document.removeEventListener("keydown", handleKeyDown2);
29102
- }, [onClose]);
29103
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
29104
- SlashCommandList,
29105
- {
29106
- ref: listRef,
29107
- items,
29108
- messages,
29109
- command: (item) => {
29110
- item.command({ editor });
29111
- onClose();
29112
- }
29113
- }
29114
- );
29115
- };
29116
- var FloatingMenuContent = ({ editor }) => {
29117
- const t = useSmartTranslations("UEditor");
29118
- const [showCommands, setShowCommands] = (0, import_react62.useState)(false);
29119
- if (showCommands) {
29120
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
29121
- }
29122
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
29123
- "button",
29124
- {
29125
- type: "button",
29126
- onClick: () => setShowCommands(true),
29127
- className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
29128
- children: [
29129
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
29130
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
29131
- ]
29132
- }
29133
- );
29134
- };
29135
29134
  function applyTableCellBackground(editor, color) {
29136
29135
  const value = color || null;
29137
29136
  const { state, view } = editor;
@@ -29758,54 +29757,6 @@ var CustomBubbleMenu = ({
29758
29757
  document.body
29759
29758
  );
29760
29759
  };
29761
- var CustomFloatingMenu = ({ editor }) => {
29762
- const FLOATING_MENU_OFFSET = 16;
29763
- const [isVisible, setIsVisible] = (0, import_react62.useState)(false);
29764
- const [position, setPosition] = (0, import_react62.useState)({ top: 0, left: 0 });
29765
- (0, import_react62.useEffect)(() => {
29766
- const updatePosition = () => {
29767
- const { state, view } = editor;
29768
- const { $from, empty } = state.selection;
29769
- const isEmptyTextBlock = $from.parent.isTextblock && $from.parent.type.name === "paragraph" && $from.parent.textContent === "" && empty;
29770
- if (!isEmptyTextBlock || !view.hasFocus()) {
29771
- setIsVisible(false);
29772
- return;
29773
- }
29774
- const coords = view.coordsAtPos($from.pos);
29775
- setPosition({ top: coords.top - FLOATING_MENU_OFFSET, left: coords.left });
29776
- setIsVisible(true);
29777
- };
29778
- const handleBlur = () => setIsVisible(false);
29779
- editor.on("selectionUpdate", updatePosition);
29780
- editor.on("focus", updatePosition);
29781
- editor.on("blur", handleBlur);
29782
- editor.on("update", updatePosition);
29783
- return () => {
29784
- editor.off("selectionUpdate", updatePosition);
29785
- editor.off("focus", updatePosition);
29786
- editor.off("blur", handleBlur);
29787
- editor.off("update", updatePosition);
29788
- };
29789
- }, [editor]);
29790
- if (!isVisible) return null;
29791
- return (0, import_react_dom8.createPortal)(
29792
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
29793
- "div",
29794
- {
29795
- "data-popover": true,
29796
- className: "fixed z-99999 rounded-2xl border border-border/50 bg-card text-card-foreground shadow-lg backdrop-blur-sm overflow-hidden animate-in fade-in-0 slide-in-from-bottom-2",
29797
- style: {
29798
- top: `${position.top}px`,
29799
- left: `${position.left}px`,
29800
- transform: "translate(-50%, -100%)"
29801
- },
29802
- onMouseDown: (e) => e.preventDefault(),
29803
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(FloatingMenuContent, { editor })
29804
- }
29805
- ),
29806
- document.body
29807
- );
29808
- };
29809
29760
 
29810
29761
  // src/components/UEditor/CharacterCount.tsx
29811
29762
  var import_jsx_runtime87 = require("react/jsx-runtime");
@@ -34580,8 +34531,8 @@ function TableAddRails({
34580
34531
  const visibleTableHeight = Math.min(layout.tableHeight, layout.viewportHeight);
34581
34532
  const columnRailTop = layout.tableTop;
34582
34533
  const columnRailLeft = layout.tableLeft + visibleTableWidth + ADD_COLUMN_RAIL_GAP;
34583
- const rowRailTop = layout.tableTop + visibleTableHeight + ADD_ROW_RAIL_GAP;
34584
- const rowRailLeft = layout.tableLeft;
34534
+ const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
34535
+ const rowRailLeft = Math.max(layout.tableLeft, layout.wrapperLeft);
34585
34536
  const showColumnRail = controlsVisible || addColumnVisible;
34586
34537
  const showRowRail = controlsVisible || addRowVisible;
34587
34538
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
@@ -35211,6 +35162,7 @@ function TableControls({ editor, containerRef }) {
35211
35162
  const proseMirror = editor.view.dom;
35212
35163
  const surface = containerRef.current;
35213
35164
  if (!surface) return void 0;
35165
+ const scrollListenerOptions = { passive: true, capture: true };
35214
35166
  const handleMouseOver = (event) => {
35215
35167
  if (dragStateRef.current) return;
35216
35168
  const cell = getCellFromTarget(event.target);
@@ -35236,7 +35188,7 @@ function TableControls({ editor, containerRef }) {
35236
35188
  proseMirror.addEventListener("focusin", handleFocusIn);
35237
35189
  surface.addEventListener("mouseover", handleSurfaceMouseMove);
35238
35190
  surface.addEventListener("mousemove", handleSurfaceMouseMove);
35239
- surface.addEventListener("scroll", refreshCurrentLayout, { passive: true });
35191
+ surface.addEventListener("scroll", refreshCurrentLayout, scrollListenerOptions);
35240
35192
  surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, refreshCurrentLayout);
35241
35193
  window.addEventListener("resize", refreshCurrentLayout);
35242
35194
  editor.on("selectionUpdate", syncFromSelection);
@@ -35250,7 +35202,7 @@ function TableControls({ editor, containerRef }) {
35250
35202
  proseMirror.removeEventListener("focusin", handleFocusIn);
35251
35203
  surface.removeEventListener("mouseover", handleSurfaceMouseMove);
35252
35204
  surface.removeEventListener("mousemove", handleSurfaceMouseMove);
35253
- surface.removeEventListener("scroll", refreshCurrentLayout);
35205
+ surface.removeEventListener("scroll", refreshCurrentLayout, scrollListenerOptions);
35254
35206
  surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, refreshCurrentLayout);
35255
35207
  window.removeEventListener("resize", refreshCurrentLayout);
35256
35208
  editor.off("selectionUpdate", syncFromSelection);
@@ -35720,7 +35672,7 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
35720
35672
  "[&_.column-resize-handle]:top-[-1px]",
35721
35673
  "[&_.column-resize-handle]:bottom-[-1px]",
35722
35674
  "[&_.column-resize-handle]:right-[-5px]",
35723
- "[&_.column-resize-handle]:z-10",
35675
+ "[&_.column-resize-handle]:z-30",
35724
35676
  "[&_.column-resize-handle]:w-2.5",
35725
35677
  "[&_.column-resize-handle]:bg-transparent",
35726
35678
  "[&_.column-resize-handle]:rounded-none",
@@ -35974,26 +35926,31 @@ function useUEditorTableInteractions(editor, editable = true) {
35974
35926
  const activeTableCellRef = (0, import_react66.useRef)(null);
35975
35927
  const suppressActiveCellHighlightRef = (0, import_react66.useRef)(false);
35976
35928
  const tableLayoutSyncFrameRef = (0, import_react66.useRef)(null);
35929
+ const getProseMirrorElement = import_react66.default.useCallback(() => {
35930
+ return editorContentRef.current?.querySelector(".ProseMirror");
35931
+ }, []);
35977
35932
  const setEditorResizeCursor = import_react66.default.useCallback((cursor) => {
35978
- const proseMirror = editorContentRef.current?.querySelector(".ProseMirror");
35933
+ const proseMirror = getProseMirrorElement();
35979
35934
  if (proseMirror) {
35980
35935
  proseMirror.style.cursor = cursor;
35981
35936
  }
35982
- }, []);
35937
+ }, [getProseMirrorElement]);
35983
35938
  const hideColumnGuide = import_react66.default.useCallback(() => {
35984
35939
  editorContentRef.current?.classList.remove("resize-cursor");
35940
+ getProseMirrorElement()?.classList.remove("resize-cursor");
35985
35941
  const guide = tableColumnGuideRef.current;
35986
35942
  if (guide) {
35987
35943
  guide.style.opacity = "0";
35988
35944
  }
35989
- }, []);
35945
+ }, [getProseMirrorElement]);
35990
35946
  const hideRowGuide = import_react66.default.useCallback(() => {
35991
35947
  editorContentRef.current?.classList.remove("resize-row-cursor");
35948
+ getProseMirrorElement()?.classList.remove("resize-row-cursor");
35992
35949
  const guide = tableRowGuideRef.current;
35993
35950
  if (guide) {
35994
35951
  guide.style.opacity = "0";
35995
35952
  }
35996
- }, []);
35953
+ }, [getProseMirrorElement]);
35997
35954
  const clearAllTableResizeHover = import_react66.default.useCallback(() => {
35998
35955
  setEditorResizeCursor("");
35999
35956
  hideColumnGuide();
@@ -36023,7 +35980,10 @@ function useUEditorTableInteractions(editor, editable = true) {
36023
35980
  });
36024
35981
  }, [updateActiveCellHighlight]);
36025
35982
  const setActiveTableCell = import_react66.default.useCallback((cell) => {
36026
- if (activeTableCellRef.current === cell) return;
35983
+ if (activeTableCellRef.current === cell) {
35984
+ updateActiveCellHighlight(cell);
35985
+ return;
35986
+ }
36027
35987
  activeTableCellRef.current = cell;
36028
35988
  updateActiveCellHighlight(activeTableCellRef.current);
36029
35989
  }, [updateActiveCellHighlight]);
@@ -36048,8 +36008,9 @@ function useUEditorTableInteractions(editor, editable = true) {
36048
36008
  guide.style.height = `${metrics.height}px`;
36049
36009
  guide.style.opacity = "1";
36050
36010
  surface.classList.add("resize-cursor");
36011
+ getProseMirrorElement()?.classList.add("resize-cursor");
36051
36012
  setEditorResizeCursor("col-resize");
36052
- }, [setEditorResizeCursor]);
36013
+ }, [getProseMirrorElement, setEditorResizeCursor]);
36053
36014
  const showRowGuide = import_react66.default.useCallback((table, row, cell) => {
36054
36015
  const surface = editorContentRef.current;
36055
36016
  const guide = tableRowGuideRef.current;
@@ -36061,8 +36022,9 @@ function useUEditorTableInteractions(editor, editable = true) {
36061
36022
  guide.style.height = `${ROW_RESIZE_LINE_THICKNESS}px`;
36062
36023
  guide.style.opacity = "1";
36063
36024
  surface.classList.add("resize-row-cursor");
36025
+ getProseMirrorElement()?.classList.add("resize-row-cursor");
36064
36026
  setEditorResizeCursor("row-resize");
36065
- }, [setEditorResizeCursor]);
36027
+ }, [getProseMirrorElement, setEditorResizeCursor]);
36066
36028
  const {
36067
36029
  beginResize,
36068
36030
  cancelResize,
@@ -36081,19 +36043,32 @@ function useUEditorTableInteractions(editor, editable = true) {
36081
36043
  });
36082
36044
  const syncActiveTableCellFromSelection = import_react66.default.useCallback(() => {
36083
36045
  if (!editor) return;
36046
+ if (!editor.isFocused) {
36047
+ clearActiveTableCell();
36048
+ return;
36049
+ }
36084
36050
  setActiveTableCell(getSelectionTableCell(editor.view));
36085
- }, [editor, setActiveTableCell]);
36051
+ }, [clearActiveTableCell, editor, setActiveTableCell]);
36086
36052
  (0, import_react66.useEffect)(() => {
36087
36053
  if (!editor || !editable) return void 0;
36088
36054
  const proseMirror = editor.view.dom;
36089
36055
  const surface = editorContentRef.current;
36090
36056
  let selectionSyncTimeoutId = 0;
36057
+ const scrollListenerOptions = { passive: true, capture: true };
36091
36058
  const scheduleActiveCellSync = (fallbackCell = null) => {
36092
36059
  requestAnimationFrame(() => {
36060
+ if (!editor.isFocused) {
36061
+ clearActiveTableCell();
36062
+ return;
36063
+ }
36093
36064
  setActiveTableCell(getSelectionTableCell(editor.view) ?? fallbackCell);
36094
36065
  });
36095
36066
  window.clearTimeout(selectionSyncTimeoutId);
36096
36067
  selectionSyncTimeoutId = window.setTimeout(() => {
36068
+ if (!editor.isFocused) {
36069
+ clearActiveTableCell();
36070
+ return;
36071
+ }
36097
36072
  setActiveTableCell(getSelectionTableCell(editor.view) ?? fallbackCell);
36098
36073
  }, 0);
36099
36074
  };
@@ -36197,13 +36172,15 @@ function useUEditorTableInteractions(editor, editable = true) {
36197
36172
  proseMirror.addEventListener("keyup", handleSelectionChange);
36198
36173
  proseMirror.addEventListener("focusin", handleSelectionChange);
36199
36174
  document.addEventListener("selectionchange", handleSelectionChange);
36200
- surface?.addEventListener("scroll", handleActiveCellLayoutChange, { passive: true });
36175
+ surface?.addEventListener("scroll", handleActiveCellLayoutChange, scrollListenerOptions);
36201
36176
  window.addEventListener("resize", handleActiveCellLayoutChange);
36202
36177
  document.addEventListener("pointermove", handlePointerMove);
36203
36178
  document.addEventListener("pointerup", handlePointerUp);
36204
36179
  window.addEventListener("blur", handleWindowBlur);
36205
36180
  editor.on("selectionUpdate", syncActiveTableCellFromSelection);
36206
36181
  editor.on("focus", syncActiveTableCellFromSelection);
36182
+ editor.on("blur", clearActiveTableCell);
36183
+ editor.on("update", scheduleTableLayoutSync);
36207
36184
  syncActiveTableCellFromSelection();
36208
36185
  return () => {
36209
36186
  proseMirror.removeEventListener("mousemove", handleEditorMouseMove);
@@ -36214,13 +36191,15 @@ function useUEditorTableInteractions(editor, editable = true) {
36214
36191
  proseMirror.removeEventListener("keyup", handleSelectionChange);
36215
36192
  proseMirror.removeEventListener("focusin", handleSelectionChange);
36216
36193
  document.removeEventListener("selectionchange", handleSelectionChange);
36217
- surface?.removeEventListener("scroll", handleActiveCellLayoutChange);
36194
+ surface?.removeEventListener("scroll", handleActiveCellLayoutChange, scrollListenerOptions);
36218
36195
  window.removeEventListener("resize", handleActiveCellLayoutChange);
36219
36196
  document.removeEventListener("pointermove", handlePointerMove);
36220
36197
  document.removeEventListener("pointerup", handlePointerUp);
36221
36198
  window.removeEventListener("blur", handleWindowBlur);
36222
36199
  editor.off("selectionUpdate", syncActiveTableCellFromSelection);
36223
36200
  editor.off("focus", syncActiveTableCellFromSelection);
36201
+ editor.off("blur", clearActiveTableCell);
36202
+ editor.off("update", scheduleTableLayoutSync);
36224
36203
  window.clearTimeout(selectionSyncTimeoutId);
36225
36204
  if (tableLayoutSyncFrameRef.current !== null) {
36226
36205
  window.cancelAnimationFrame(tableLayoutSyncFrameRef.current);
@@ -36233,7 +36212,7 @@ function useUEditorTableInteractions(editor, editable = true) {
36233
36212
  clearHoveredTableCell();
36234
36213
  clearAllTableResizeHover();
36235
36214
  };
36236
- }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
36215
+ }, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
36237
36216
  return {
36238
36217
  editorContentRef,
36239
36218
  tableColumnGuideRef,
@@ -36735,6 +36714,13 @@ var MenuBar = ({
36735
36714
  const openPreviewDialog = () => {
36736
36715
  setShowPreviewDialog(true);
36737
36716
  };
36717
+ const handlePreview = () => {
36718
+ if (onPreview) {
36719
+ onPreview();
36720
+ return;
36721
+ }
36722
+ openPreviewDialog();
36723
+ };
36738
36724
  const applySourceHtml = () => {
36739
36725
  editor.chain().focus().setContent(sourceHtml).run();
36740
36726
  setShowSourceDialog(false);
@@ -36846,7 +36832,7 @@ var MenuBar = ({
36846
36832
  { label: t("menubar.edit"), items: buildEditMenuItems(t, editor), open: void 0, onOpenChange: void 0 },
36847
36833
  {
36848
36834
  label: t("menubar.view"),
36849
- items: buildViewMenuItems(t, { containerRef, onSourceCode, openSourceDialog, onPreview, openPreviewDialog }),
36835
+ items: buildViewMenuItems(t, { containerRef, onSourceCode, openSourceDialog, onPreview: handlePreview, openPreviewDialog }),
36850
36836
  open: void 0,
36851
36837
  onOpenChange: void 0
36852
36838
  },
@@ -36883,17 +36869,33 @@ var MenuBar = ({
36883
36869
  onChange: (e) => handleImageFiles(e.target.files)
36884
36870
  }
36885
36871
  ),
36886
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
36887
- DropdownMenu,
36888
- {
36889
- trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(MenuBarTrigger, { children: label }),
36890
- placement: "bottom-start",
36891
- isOpen: open,
36892
- onOpenChange,
36893
- children: renderMenuItems(items)
36894
- },
36895
- label
36896
- )) }),
36872
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
36873
+ menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
36874
+ DropdownMenu,
36875
+ {
36876
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(MenuBarTrigger, { children: label }),
36877
+ placement: "bottom-start",
36878
+ isOpen: open,
36879
+ onOpenChange,
36880
+ children: renderMenuItems(items)
36881
+ },
36882
+ label
36883
+ )),
36884
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
36885
+ "button",
36886
+ {
36887
+ type: "button",
36888
+ onClick: handlePreview,
36889
+ "aria-label": t("menubar.preview"),
36890
+ title: t("menubar.preview"),
36891
+ className: cn(
36892
+ "ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
36893
+ "hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
36894
+ ),
36895
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react53.Eye, { className: "h-4 w-4", "aria-hidden": "true" })
36896
+ }
36897
+ )
36898
+ ] }),
36897
36899
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
36898
36900
  Modal_default,
36899
36901
  {
@@ -36947,8 +36949,14 @@ var MenuBar = ({
36947
36949
  "div",
36948
36950
  {
36949
36951
  "data-testid": "preview-content",
36950
- className: UEDITOR_PROSEMIRROR_CLASS_NAME,
36951
- dangerouslySetInnerHTML: { __html: editor.getHTML() }
36952
+ className: "max-h-[70vh] overflow-y-auto overscroll-contain pr-2",
36953
+ children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
36954
+ "div",
36955
+ {
36956
+ className: UEDITOR_PROSEMIRROR_CLASS_NAME,
36957
+ dangerouslySetInnerHTML: { __html: editor.getHTML() }
36958
+ }
36959
+ )
36952
36960
  }
36953
36961
  )
36954
36962
  }
@@ -36976,7 +36984,6 @@ var UEditor = import_react69.default.forwardRef(({
36976
36984
  autofocus = false,
36977
36985
  showToolbar = true,
36978
36986
  showBubbleMenu = true,
36979
- showFloatingMenu = false,
36980
36987
  showCharacterCount = true,
36981
36988
  maxCharacters,
36982
36989
  minHeight = "200px",
@@ -37178,7 +37185,6 @@ var UEditor = import_react69.default.forwardRef(({
37178
37185
  lineHeights
37179
37186
  }
37180
37187
  ),
37181
- editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(CustomFloatingMenu, { editor }),
37182
37188
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
37183
37189
  "div",
37184
37190
  {
@@ -37211,7 +37217,7 @@ var UEditor = import_react69.default.forwardRef(({
37211
37217
  ref: activeTableCellHighlightRef,
37212
37218
  "aria-hidden": "true",
37213
37219
  "data-ueditor-active-cell-highlight": "",
37214
- className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10 transition-[left,top,width,height] duration-100"
37220
+ className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
37215
37221
  }
37216
37222
  ),
37217
37223
  editable && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TableControls, { editor, containerRef: editorContentRef }),