@underverse-ui/underverse 2.0.32 → 2.0.34

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 (30) hide show
  1. package/api-reference.json +1 -1
  2. package/dist/{EmojiPicker-ISJ6RXYG.js → EmojiPicker-6H52Q4YE.js} +4 -4
  3. package/dist/{chunk-ZP7F4ZD7.js → chunk-6FAHXNDQ.js} +5 -1
  4. package/dist/chunk-6FAHXNDQ.js.map +1 -0
  5. package/dist/{chunk-C4KZOMP3.js → chunk-JYAEYUGM.js} +36 -101
  6. package/dist/chunk-JYAEYUGM.js.map +1 -0
  7. package/dist/{chunk-S4UHFRL3.js → chunk-L73HBI6E.js} +3 -3
  8. package/dist/{chunk-4TXHZS3S.js → chunk-OTPC2OTQ.js} +2 -2
  9. package/dist/{chunk-RSSSQS2A.js → chunk-UHUKUI5S.js} +3 -3
  10. package/dist/{chunk-5W63IHIN.js → chunk-W3QTP2DM.js} +2 -2
  11. package/dist/index.cjs +68 -133
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +8 -0
  14. package/dist/index.d.ts +8 -0
  15. package/dist/index.js +6 -6
  16. package/dist/{menu-bar-GDDGHNNJ.js → menu-bar-HZBBRX42.js} +4 -4
  17. package/dist/ueditor.cjs +83 -148
  18. package/dist/ueditor.cjs.map +1 -1
  19. package/dist/ueditor.d.cts +1 -1
  20. package/dist/ueditor.d.ts +1 -1
  21. package/dist/ueditor.js +4 -4
  22. package/package.json +1 -1
  23. package/dist/chunk-C4KZOMP3.js.map +0 -1
  24. package/dist/chunk-ZP7F4ZD7.js.map +0 -1
  25. /package/dist/{EmojiPicker-ISJ6RXYG.js.map → EmojiPicker-6H52Q4YE.js.map} +0 -0
  26. /package/dist/{chunk-S4UHFRL3.js.map → chunk-L73HBI6E.js.map} +0 -0
  27. /package/dist/{chunk-4TXHZS3S.js.map → chunk-OTPC2OTQ.js.map} +0 -0
  28. /package/dist/{chunk-RSSSQS2A.js.map → chunk-UHUKUI5S.js.map} +0 -0
  29. /package/dist/{chunk-5W63IHIN.js.map → chunk-W3QTP2DM.js.map} +0 -0
  30. /package/dist/{menu-bar-GDDGHNNJ.js.map → menu-bar-HZBBRX42.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EmojiGridButton,
3
3
  formatEmojiCountLabel
4
- } from "./chunk-5W63IHIN.js";
4
+ } from "./chunk-W3QTP2DM.js";
5
5
  import {
6
6
  COLUMN_RESIZE_LINE_THICKNESS,
7
7
  CellBgColorIcon,
@@ -94,7 +94,7 @@ import {
94
94
  sanitizeUEditorUrl,
95
95
  useEditorColors,
96
96
  useSharedEditorUiRenderState
97
- } from "./chunk-4TXHZS3S.js";
97
+ } from "./chunk-OTPC2OTQ.js";
98
98
  import {
99
99
  Tooltip,
100
100
  UEditorPortalProvider,
@@ -104,7 +104,7 @@ import {
104
104
  resolveUEditorPortalContainer,
105
105
  useSmartTranslations,
106
106
  useUEditorPortalContainerGetter
107
- } from "./chunk-ZP7F4ZD7.js";
107
+ } from "./chunk-6FAHXNDQ.js";
108
108
 
109
109
  // src/components/UEditor/prepare-content-for-save.ts
110
110
  var MIME_EXTENSION_MAP = {
@@ -522,7 +522,7 @@ async function prepareUEditorContentForSave({
522
522
  }
523
523
 
524
524
  // src/components/UEditor/UEditor.tsx
525
- import React17, { useEffect as useEffect10, useImperativeHandle as useImperativeHandle4, useMemo as useMemo2, useRef as useRef10 } from "react";
525
+ import React16, { useEffect as useEffect10, useImperativeHandle as useImperativeHandle4, useMemo as useMemo2, useRef as useRef10 } from "react";
526
526
  import { useEditor, EditorContent } from "@tiptap/react";
527
527
 
528
528
  // src/components/UEditor/extensions.ts
@@ -557,7 +557,7 @@ import { NodeViewWrapper, NodeViewContent } from "@tiptap/react";
557
557
  import React from "react";
558
558
  import { jsx } from "react/jsx-runtime";
559
559
  var LazyBaseEmojiPicker = React.lazy(async () => {
560
- const { EmojiPicker: EmojiPicker2 } = await import("./EmojiPicker-ISJ6RXYG.js");
560
+ const { EmojiPicker: EmojiPicker2 } = await import("./EmojiPicker-6H52Q4YE.js");
561
561
  return { default: EmojiPicker2 };
562
562
  });
563
563
  var EmojiPicker = ({ onSelect }) => {
@@ -11545,6 +11545,7 @@ import {
11545
11545
  ArrowRight as ArrowRight2,
11546
11546
  ArrowUp,
11547
11547
  Copy as Copy2,
11548
+ Minimize2,
11548
11549
  Paintbrush,
11549
11550
  Table as TableIcon,
11550
11551
  Trash2 as Trash22
@@ -12056,7 +12057,9 @@ function TableAddRails({
12056
12057
  ),
12057
12058
  style: {
12058
12059
  top: columnRailTop,
12059
- left: columnRailLeft,
12060
+ // An invisible rail must not sit outside the table: even at
12061
+ // opacity 0 its box would otherwise create a horizontal scrollbar.
12062
+ left: showColumnRail ? columnRailLeft : Math.max(visibleBounds.left, visibleBounds.right - BUTTON_SHORT_SIZE),
12060
12063
  width: BUTTON_SHORT_SIZE,
12061
12064
  height: BUTTON_LONG_SIZE,
12062
12065
  opacity: showColumnRail ? 1 : 0,
@@ -12334,18 +12337,16 @@ function TableColumnHandles({
12334
12337
  // src/components/UEditor/table-resize-handles.tsx
12335
12338
  import { MoveDiagonal2 } from "lucide-react";
12336
12339
  import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
12337
- var HANDLE_BASE_CLASS = cn(
12338
- "pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center rounded-md",
12339
- "bg-background/95 text-primary shadow-sm backdrop-blur-sm",
12340
- "transition-[color,background-color,box-shadow,transform] duration-150",
12341
- "hover:bg-primary hover:text-primary-foreground hover:shadow-md active:scale-95",
12342
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
12343
- );
12344
12340
  var EDGE_HANDLE_CLASS = cn(
12345
12341
  "pointer-events-auto absolute top-0 z-10 h-full w-2 touch-none cursor-col-resize bg-transparent p-0",
12346
12342
  "border-transparent transition-colors duration-150 hover:border-primary",
12347
12343
  "focus-visible:border-primary focus-visible:outline-none"
12348
12344
  );
12345
+ var CORNER_HANDLE_CLASS = cn(
12346
+ "pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center p-0",
12347
+ "text-primary/70 transition-[color,transform] duration-150 hover:text-primary active:scale-95",
12348
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
12349
+ );
12349
12350
  function formatTableResizeDimensionLabel({
12350
12351
  width,
12351
12352
  height,
@@ -12425,9 +12426,9 @@ function TableResizeHandles({
12425
12426
  title: `${resizeBothLabel}. ${ctrlHint}`,
12426
12427
  "data-table-resize-handle": "both",
12427
12428
  className: cn(
12428
- HANDLE_BASE_CLASS,
12429
- "bottom-[-28px] right-[-30px] h-6 w-6 cursor-nwse-resize",
12430
- active && "bg-primary text-primary-foreground shadow-md"
12429
+ CORNER_HANDLE_CLASS,
12430
+ "bottom-[-28px] right-0 h-6 w-6 cursor-nwse-resize",
12431
+ active && "text-primary"
12431
12432
  ),
12432
12433
  onDoubleClick: onFitWidth,
12433
12434
  onClick: (event) => {
@@ -13024,8 +13025,8 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
13024
13025
  updateTableResizePreview(pendingDimensions);
13025
13026
  setDocumentCursor(editorDocument, edge === "both" ? "nwse-resize" : "ew-resize");
13026
13027
  }, [editor, editorDocument, updateTableResizePreview]);
13027
- const fitTableToEditorWidth = React11.useCallback((event) => {
13028
- if (event.button !== 0 || dragStateRef.current) return;
13028
+ const fitTableToEditorWidth = React11.useCallback(() => {
13029
+ if (dragStateRef.current) return;
13029
13030
  const activeLayout = layoutRef.current;
13030
13031
  if (!activeLayout) return;
13031
13032
  const snapshot = createTableSizeSnapshot(
@@ -13036,8 +13037,6 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
13036
13037
  activeLayout.viewportWidth
13037
13038
  );
13038
13039
  if (!snapshot) return;
13039
- event.preventDefault();
13040
- event.stopPropagation();
13041
13040
  const didResize = applyTableSize(editor, snapshot, {
13042
13041
  width: Math.round(activeLayout.viewportWidth),
13043
13042
  height: snapshot.startHeight,
@@ -13425,6 +13424,11 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
13425
13424
  icon: Paintbrush,
13426
13425
  onClick: openCellInspector
13427
13426
  }] : [],
13427
+ {
13428
+ label: t("tableMenu.fitToEditorWidth"),
13429
+ icon: Minimize2,
13430
+ onClick: fitTableToEditorWidth
13431
+ },
13428
13432
  {
13429
13433
  label: t("tableMenu.alignLeft"),
13430
13434
  icon: AlignLeft2,
@@ -13489,7 +13493,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
13489
13493
  destructive: true
13490
13494
  }
13491
13495
  ];
13492
- }, [editor, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
13496
+ }, [editor, fitTableToEditorWidth, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
13493
13497
  const getRowHandleMenuItems = React11.useCallback((rowHandle) => [
13494
13498
  {
13495
13499
  label: t("tableMenu.addRowBefore"),
@@ -14881,78 +14885,13 @@ function useUEditorOutput({
14881
14885
  };
14882
14886
  }
14883
14887
 
14884
- // src/components/UEditor/use-wide-table-layout.ts
14885
- import React16 from "react";
14886
- function useWideTableLayout(editor, enabled, widthBoundaryRef, editorShellRef, editorSurfaceRef) {
14887
- React16.useLayoutEffect(() => {
14888
- const boundary = widthBoundaryRef.current;
14889
- const shell = editorShellRef.current;
14890
- const surface = editorSurfaceRef.current;
14891
- if (!editor || !boundary || !shell || !surface) return;
14892
- const editorDocument = editor.view.dom.ownerDocument;
14893
- const editorWindow = editorDocument.defaultView;
14894
- if (!editorWindow) return;
14895
- const editorDom = editor.view.dom;
14896
- let frame = 0;
14897
- const resetWidths = () => {
14898
- shell.style.removeProperty("width");
14899
- editorDom.style.removeProperty("width");
14900
- };
14901
- const sync = () => {
14902
- frame = 0;
14903
- resetWidths();
14904
- if (!enabled || editor.isDestroyed) return;
14905
- const boundaryWidth = boundary.getBoundingClientRect().width || boundary.clientWidth;
14906
- const surfaceWidth = surface.getBoundingClientRect().width || surface.clientWidth;
14907
- if (boundaryWidth <= 0 || surfaceWidth <= 0) return;
14908
- editorDom.style.width = `${surfaceWidth}px`;
14909
- const shellRect = shell.getBoundingClientRect();
14910
- let requiredWidth = boundaryWidth;
14911
- editorDom.querySelectorAll("table").forEach((table) => {
14912
- const tableRect = table.getBoundingClientRect();
14913
- if (tableRect.width > 0) {
14914
- requiredWidth = Math.max(requiredWidth, tableRect.right - shellRect.left + 32);
14915
- return;
14916
- }
14917
- const widthBp = Number(table.getAttribute("data-table-width-bp"));
14918
- if (Number.isFinite(widthBp) && widthBp > 1e4) {
14919
- requiredWidth = Math.max(requiredWidth, surfaceWidth * widthBp / 1e4 + 32);
14920
- }
14921
- });
14922
- if (requiredWidth <= boundaryWidth + 1) {
14923
- editorDom.style.removeProperty("width");
14924
- return;
14925
- }
14926
- shell.style.width = `${Math.ceil(requiredWidth)}px`;
14927
- };
14928
- const schedule = () => {
14929
- if (frame) editorWindow.cancelAnimationFrame(frame);
14930
- frame = editorWindow.requestAnimationFrame(sync);
14931
- };
14932
- const resizeObserver = typeof editorWindow.ResizeObserver === "function" ? new editorWindow.ResizeObserver(schedule) : null;
14933
- resizeObserver?.observe(boundary);
14934
- editor.on("transaction", schedule);
14935
- surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
14936
- editorWindow.addEventListener("resize", schedule);
14937
- schedule();
14938
- return () => {
14939
- if (frame) editorWindow.cancelAnimationFrame(frame);
14940
- resizeObserver?.disconnect();
14941
- editor.off("transaction", schedule);
14942
- surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
14943
- editorWindow.removeEventListener("resize", schedule);
14944
- resetWidths();
14945
- };
14946
- }, [editor, editorShellRef, editorSurfaceRef, enabled, widthBoundaryRef]);
14947
- }
14948
-
14949
14888
  // src/components/UEditor/UEditor.tsx
14950
14889
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
14951
- var LazyMenuBar = React17.lazy(async () => {
14952
- const { MenuBar } = await import("./menu-bar-GDDGHNNJ.js");
14890
+ var LazyMenuBar = React16.lazy(async () => {
14891
+ const { MenuBar } = await import("./menu-bar-HZBBRX42.js");
14953
14892
  return { default: MenuBar };
14954
14893
  });
14955
- var UEditor = React17.forwardRef(({
14894
+ var UEditor = React16.forwardRef(({
14956
14895
  getPortalContainer,
14957
14896
  content = "",
14958
14897
  onChange,
@@ -15011,10 +14950,8 @@ var UEditor = React17.forwardRef(({
15011
14950
  const editorInstanceRef = useRef10(null);
15012
14951
  const formulaRangePickRef = useRef10(null);
15013
14952
  const formulaRangeSurfaceRef = useRef10(null);
15014
- const [formulaRangeHighlight, setFormulaRangeHighlight] = React17.useState(null);
15015
- const [isMenuBarVisible, setIsMenuBarVisible] = React17.useState(showMenuBar);
15016
- const widthBoundaryRef = useRef10(null);
15017
- const editorShellRef = useRef10(null);
14953
+ const [formulaRangeHighlight, setFormulaRangeHighlight] = React16.useState(null);
14954
+ const [isMenuBarVisible, setIsMenuBarVisible] = React16.useState(showMenuBar);
15018
14955
  useEffect10(() => {
15019
14956
  setIsMenuBarVisible(showMenuBar);
15020
14957
  }, [showMenuBar]);
@@ -15024,7 +14961,7 @@ var UEditor = React17.forwardRef(({
15024
14961
  onJsonChange,
15025
14962
  outputDebounceMs
15026
14963
  });
15027
- const scheduleFormulaRecalculate = React17.useCallback((editor2, options) => {
14964
+ const scheduleFormulaRecalculate = React16.useCallback((editor2, options) => {
15028
14965
  if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
15029
14966
  if (!options?.force && isEditingTableFormulaText(editor2)) return;
15030
14967
  scheduledFormulaRecalculateRef.current = true;
@@ -15066,7 +15003,7 @@ var UEditor = React17.forwardRef(({
15066
15003
  ],
15067
15004
  [getPortalContainer, effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, onImageUploadError, editable, fetchMetadata, extraExtensions]
15068
15005
  );
15069
- const syncFormulaRangeHighlight = React17.useCallback((pickState) => {
15006
+ const syncFormulaRangeHighlight = React16.useCallback((pickState) => {
15070
15007
  const container = formulaRangeSurfaceRef.current;
15071
15008
  setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
15072
15009
  }, []);
@@ -15207,7 +15144,6 @@ var UEditor = React17.forwardRef(({
15207
15144
  apply: t("tableMenu.apply"),
15208
15145
  cancel: t("imageInput.cancelBtn")
15209
15146
  });
15210
- useWideTableLayout(editor, expandWideTables, widthBoundaryRef, editorShellRef, editorContentRef);
15211
15147
  useImperativeHandle4(
15212
15148
  ref,
15213
15149
  () => ({
@@ -15275,10 +15211,9 @@ var UEditor = React17.forwardRef(({
15275
15211
  }
15276
15212
  ) });
15277
15213
  }
15278
- return /* @__PURE__ */ jsx20(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ jsx20("div", { ref: widthBoundaryRef, "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ jsxs17(
15214
+ return /* @__PURE__ */ jsx20(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ jsx20("div", { "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ jsxs17(
15279
15215
  "div",
15280
15216
  {
15281
- ref: editorShellRef,
15282
15217
  className: cn(
15283
15218
  "group relative flex flex-col text-card-foreground",
15284
15219
  editable ? [
@@ -15293,7 +15228,7 @@ var UEditor = React17.forwardRef(({
15293
15228
  ),
15294
15229
  children: [
15295
15230
  editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ jsxs17(EditorUiRenderStateProvider, { editor, children: [
15296
- isMenuBarVisible && /* @__PURE__ */ jsx20(React17.Suspense, { fallback: null, children: /* @__PURE__ */ jsx20(
15231
+ isMenuBarVisible && /* @__PURE__ */ jsx20(React16.Suspense, { fallback: null, children: /* @__PURE__ */ jsx20(
15297
15232
  LazyMenuBar,
15298
15233
  {
15299
15234
  editor,
@@ -15351,7 +15286,7 @@ var UEditor = React17.forwardRef(({
15351
15286
  formulaRangeSurfaceRef.current = node;
15352
15287
  },
15353
15288
  className: cn(
15354
- "relative flex-1 overflow-y-auto",
15289
+ "relative flex-1 overflow-x-auto overflow-y-auto [scrollbar-width:thin] [scrollbar-color:hsl(var(--border))_transparent]",
15355
15290
  expandWideTables && "[&_.tableWrapper]:!overflow-visible [&_.tableWrapper]:!pb-0"
15356
15291
  ),
15357
15292
  style: {
@@ -15444,4 +15379,4 @@ export {
15444
15379
  prepareUEditorContentForSave,
15445
15380
  UEditor_default
15446
15381
  };
15447
- //# sourceMappingURL=chunk-C4KZOMP3.js.map
15382
+ //# sourceMappingURL=chunk-JYAEYUGM.js.map