@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
package/dist/ueditor.cjs CHANGED
@@ -343,6 +343,7 @@ var init_en = __esm({
343
343
  dragColumn: "Drag Column",
344
344
  resizeBoth: "Resize Table",
345
345
  resizeCtrlHint: "Drag freely. Hold Ctrl to lock to one axis; hold Ctrl+Shift to preserve proportions",
346
+ fitToEditorWidth: "Fit to Editor Width",
346
347
  alignLeft: "Align Table Left",
347
348
  alignCenter: "Align Table Center",
348
349
  alignRight: "Align Table Right",
@@ -809,6 +810,7 @@ var init_vi = __esm({
809
810
  dragColumn: "K\xE9o c\u1ED9t",
810
811
  resizeBoth: "\u0110\u1ED5i k\xEDch th\u01B0\u1EDBc b\u1EA3ng",
811
812
  resizeCtrlHint: "K\xE9o t\u1EF1 do; gi\u1EEF Ctrl \u0111\u1EC3 kh\xF3a m\u1ED9t chi\u1EC1u, ho\u1EB7c Ctrl+Shift \u0111\u1EC3 gi\u1EEF nguy\xEAn t\u1EF7 l\u1EC7",
813
+ fitToEditorWidth: "V\u1EEBa chi\u1EC1u r\u1ED9ng tr\xECnh so\u1EA1n th\u1EA3o",
812
814
  alignLeft: "C\u0103n b\u1EA3ng tr\xE1i",
813
815
  alignCenter: "C\u0103n b\u1EA3ng gi\u1EEFa",
814
816
  alignRight: "C\u0103n b\u1EA3ng ph\u1EA3i",
@@ -1275,6 +1277,7 @@ var init_ko = __esm({
1275
1277
  dragColumn: "\uC5F4 \uB4DC\uB798\uADF8",
1276
1278
  resizeBoth: "\uD45C \uD06C\uAE30 \uC870\uC808",
1277
1279
  resizeCtrlHint: "\uC790\uC720\uB86D\uAC8C \uB4DC\uB798\uADF8\uD569\uB2C8\uB2E4. Ctrl \uD0A4\uB97C \uB204\uB974\uBA74 \uD55C \uCD95\uC73C\uB85C \uACE0\uC815\uB418\uACE0, Ctrl+Shift \uD0A4\uB97C \uB204\uB974\uBA74 \uBE44\uC728\uC774 \uC720\uC9C0\uB429\uB2C8\uB2E4",
1280
+ fitToEditorWidth: "\uD3B8\uC9D1\uAE30 \uB108\uBE44\uC5D0 \uB9DE\uCD94\uAE30",
1278
1281
  alignLeft: "\uD45C \uC67C\uCABD \uC815\uB82C",
1279
1282
  alignCenter: "\uD45C \uAC00\uC6B4\uB370 \uC815\uB82C",
1280
1283
  alignRight: "\uD45C \uC624\uB978\uCABD \uC815\uB82C",
@@ -1741,6 +1744,7 @@ var init_ja = __esm({
1741
1744
  dragColumn: "\u5217\u3092\u30C9\u30E9\u30C3\u30B0",
1742
1745
  resizeBoth: "\u8868\u306E\u30B5\u30A4\u30BA\u3092\u5909\u66F4",
1743
1746
  resizeCtrlHint: "\u81EA\u7531\u306B\u30C9\u30E9\u30C3\u30B0\u3067\u304D\u307E\u3059\u3002Ctrl\u30AD\u30FC\u30671\u65B9\u5411\u306B\u56FA\u5B9A\u3057\u3001Ctrl+Shift\u30AD\u30FC\u3067\u7E26\u6A2A\u6BD4\u3092\u7DAD\u6301\u3057\u307E\u3059",
1747
+ fitToEditorWidth: "\u30A8\u30C7\u30A3\u30BF\u30FC\u306E\u5E45\u306B\u5408\u308F\u305B\u308B",
1744
1748
  alignLeft: "\u8868\u3092\u5DE6\u5BC4\u305B",
1745
1749
  alignCenter: "\u8868\u3092\u4E2D\u592E\u63C3\u3048",
1746
1750
  alignRight: "\u8868\u3092\u53F3\u5BC4\u305B",
@@ -9403,12 +9407,12 @@ function unlockBodyScroll(body) {
9403
9407
  body.style.overflow = current.overflow;
9404
9408
  bodyScrollLocks.delete(body);
9405
9409
  }
9406
- var React32, import_react_dom4, import_lucide_react20, import_jsx_runtime36, bodyScrollLocks, sizeStyles, Modal, Modal_default;
9410
+ var React31, import_react_dom4, import_lucide_react20, import_jsx_runtime36, bodyScrollLocks, sizeStyles, Modal, Modal_default;
9407
9411
  var init_Modal = __esm({
9408
9412
  "src/components/Modal.tsx"() {
9409
9413
  "use strict";
9410
9414
  "use client";
9411
- React32 = __toESM(require("react"), 1);
9415
+ React31 = __toESM(require("react"), 1);
9412
9416
  import_react_dom4 = require("react-dom");
9413
9417
  init_cn();
9414
9418
  import_lucide_react20 = require("lucide-react");
@@ -9448,22 +9452,22 @@ var init_Modal = __esm({
9448
9452
  const gi18n = useGlobalI18n();
9449
9453
  const globalConfig = useUnderverseUIConfig();
9450
9454
  const resolvedBorderMode = borderMode ?? globalConfig.borderMode;
9451
- const [isMounted, setIsMounted] = React32.useState(false);
9452
- const [isVisible, setIsVisible] = React32.useState(false);
9453
- const [isAnimating, setIsAnimating] = React32.useState(true);
9454
- const mouseDownTarget = React32.useRef(null);
9455
- const modalContentRef = React32.useRef(null);
9456
- const titleId = React32.useId();
9457
- const descriptionId = React32.useId();
9455
+ const [isMounted, setIsMounted] = React31.useState(false);
9456
+ const [isVisible, setIsVisible] = React31.useState(false);
9457
+ const [isAnimating, setIsAnimating] = React31.useState(true);
9458
+ const mouseDownTarget = React31.useRef(null);
9459
+ const modalContentRef = React31.useRef(null);
9460
+ const titleId = React31.useId();
9461
+ const descriptionId = React31.useId();
9458
9462
  const resolvedPortalContainer = portalContainer ?? (typeof document !== "undefined" ? document.body : null);
9459
9463
  const portalDocument = resolvedPortalContainer?.ownerDocument ?? null;
9460
9464
  const portalWindow = portalDocument?.defaultView ?? null;
9461
- React32.useEffect(() => {
9465
+ React31.useEffect(() => {
9462
9466
  setIsMounted(true);
9463
9467
  return () => setIsMounted(false);
9464
9468
  }, []);
9465
- const animationRef = React32.useRef(false);
9466
- React32.useEffect(() => {
9469
+ const animationRef = React31.useRef(false);
9470
+ React31.useEffect(() => {
9467
9471
  if (isOpen) {
9468
9472
  if (animationRef.current) return;
9469
9473
  animationRef.current = true;
@@ -9483,7 +9487,7 @@ var init_Modal = __esm({
9483
9487
  }
9484
9488
  }
9485
9489
  }, [isOpen, isVisible, portalWindow]);
9486
- React32.useEffect(() => {
9490
+ React31.useEffect(() => {
9487
9491
  if (!isOpen) return;
9488
9492
  const handleKeyDown2 = (event) => {
9489
9493
  if (event.key === "Escape" && closeOnEsc) {
@@ -9515,7 +9519,7 @@ var init_Modal = __esm({
9515
9519
  portalDocument?.addEventListener("keydown", handleKeyDown2);
9516
9520
  return () => portalDocument?.removeEventListener("keydown", handleKeyDown2);
9517
9521
  }, [isOpen, closeOnEsc, onClose, portalDocument]);
9518
- React32.useEffect(() => {
9522
+ React31.useEffect(() => {
9519
9523
  if (!isOpen || !portalDocument) return;
9520
9524
  const previousFocus = portalDocument.activeElement;
9521
9525
  const frameId = portalWindow?.requestAnimationFrame(() => modalContentRef.current?.focus());
@@ -9524,7 +9528,7 @@ var init_Modal = __esm({
9524
9528
  if (previousFocus?.isConnected) previousFocus.focus();
9525
9529
  };
9526
9530
  }, [isOpen, portalDocument, portalWindow]);
9527
- React32.useEffect(() => {
9531
+ React31.useEffect(() => {
9528
9532
  const body = portalDocument?.body;
9529
9533
  if (!isOpen || !body) return;
9530
9534
  lockBodyScroll(body);
@@ -9913,7 +9917,7 @@ function renderMenuItems(items) {
9913
9917
  case "sub":
9914
9918
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
9915
9919
  case "custom":
9916
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react45.default.Fragment, { children: item.render() }, item.key);
9920
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react44.default.Fragment, { children: item.render() }, item.key);
9917
9921
  }
9918
9922
  });
9919
9923
  }
@@ -10296,12 +10300,12 @@ function buildTableMenuItems(t, editor, onInsertTable) {
10296
10300
  }
10297
10301
  ];
10298
10302
  }
10299
- var import_react45, import_lucide_react21, import_jsx_runtime37, MenuBarTrigger, MenuBar;
10303
+ var import_react44, import_lucide_react21, import_jsx_runtime37, MenuBarTrigger, MenuBar;
10300
10304
  var init_menu_bar = __esm({
10301
10305
  "src/components/UEditor/menu-bar.tsx"() {
10302
10306
  "use strict";
10303
10307
  "use client";
10304
- import_react45 = __toESM(require("react"), 1);
10308
+ import_react44 = __toESM(require("react"), 1);
10305
10309
  import_lucide_react21 = require("lucide-react");
10306
10310
  init_useSmartTranslations();
10307
10311
  init_cn();
@@ -10318,7 +10322,7 @@ var init_menu_bar = __esm({
10318
10322
  init_async_insertion_position();
10319
10323
  init_image_file_upload();
10320
10324
  import_jsx_runtime37 = require("react/jsx-runtime");
10321
- MenuBarTrigger = import_react45.default.forwardRef(
10325
+ MenuBarTrigger = import_react44.default.forwardRef(
10322
10326
  ({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
10323
10327
  "button",
10324
10328
  {
@@ -10355,25 +10359,25 @@ var init_menu_bar = __esm({
10355
10359
  const t = useSmartTranslations("UEditor");
10356
10360
  useSharedEditorUiRenderState(editor);
10357
10361
  const getPortalContainer = useUEditorPortalContainerGetter();
10358
- const fileInputRef = (0, import_react45.useRef)(null);
10359
- const sourceTextareaRef = (0, import_react45.useRef)(null);
10360
- const [showImageInput, setShowImageInput] = (0, import_react45.useState)(false);
10361
- const [showLinkInput, setShowLinkInput] = (0, import_react45.useState)(false);
10362
- const [isUploadingImage, setIsUploadingImage] = (0, import_react45.useState)(false);
10363
- const [imageUploadError, setImageUploadError] = (0, import_react45.useState)(null);
10364
- const [openMenuKey, setOpenMenuKey] = (0, import_react45.useState)(null);
10365
- const [showSourceDialog, setShowSourceDialog] = (0, import_react45.useState)(false);
10366
- const [sourceHtml, setSourceHtml] = (0, import_react45.useState)("");
10367
- const [sourceError, setSourceError] = (0, import_react45.useState)("");
10368
- const sourceErrorId = import_react45.default.useId();
10369
- const [showPreviewDialog, setShowPreviewDialog] = (0, import_react45.useState)(false);
10370
- const [previewHtml, setPreviewHtml] = (0, import_react45.useState)("");
10362
+ const fileInputRef = (0, import_react44.useRef)(null);
10363
+ const sourceTextareaRef = (0, import_react44.useRef)(null);
10364
+ const [showImageInput, setShowImageInput] = (0, import_react44.useState)(false);
10365
+ const [showLinkInput, setShowLinkInput] = (0, import_react44.useState)(false);
10366
+ const [isUploadingImage, setIsUploadingImage] = (0, import_react44.useState)(false);
10367
+ const [imageUploadError, setImageUploadError] = (0, import_react44.useState)(null);
10368
+ const [openMenuKey, setOpenMenuKey] = (0, import_react44.useState)(null);
10369
+ const [showSourceDialog, setShowSourceDialog] = (0, import_react44.useState)(false);
10370
+ const [sourceHtml, setSourceHtml] = (0, import_react44.useState)("");
10371
+ const [sourceError, setSourceError] = (0, import_react44.useState)("");
10372
+ const sourceErrorId = import_react44.default.useId();
10373
+ const [showPreviewDialog, setShowPreviewDialog] = (0, import_react44.useState)(false);
10374
+ const [previewHtml, setPreviewHtml] = (0, import_react44.useState)("");
10371
10375
  const modalPortalContainer = resolveUEditorPortalContainer(
10372
10376
  getPortalContainer,
10373
10377
  void 0,
10374
10378
  editor.view.dom.ownerDocument
10375
10379
  );
10376
- (0, import_react45.useEffect)(() => {
10380
+ (0, import_react44.useEffect)(() => {
10377
10381
  if (!showPreviewDialog) return;
10378
10382
  const updatePreview = () => {
10379
10383
  if (!editor.isDestroyed) {
@@ -10730,9 +10734,9 @@ __export(UEditor_exports, {
10730
10734
  module.exports = __toCommonJS(UEditor_exports);
10731
10735
 
10732
10736
  // src/components/UEditor/UEditor.tsx
10733
- var import_react46 = __toESM(require("react"), 1);
10737
+ var import_react45 = __toESM(require("react"), 1);
10734
10738
  init_useSmartTranslations();
10735
- var import_react47 = require("@tiptap/react");
10739
+ var import_react46 = require("@tiptap/react");
10736
10740
  init_cn();
10737
10741
 
10738
10742
  // src/components/UEditor/extensions.ts
@@ -22676,7 +22680,9 @@ function TableAddRails({
22676
22680
  ),
22677
22681
  style: {
22678
22682
  top: columnRailTop,
22679
- left: columnRailLeft,
22683
+ // An invisible rail must not sit outside the table: even at
22684
+ // opacity 0 its box would otherwise create a horizontal scrollbar.
22685
+ left: showColumnRail ? columnRailLeft : Math.max(visibleBounds.left, visibleBounds.right - BUTTON_SHORT_SIZE),
22680
22686
  width: BUTTON_SHORT_SIZE,
22681
22687
  height: BUTTON_LONG_SIZE,
22682
22688
  opacity: showColumnRail ? 1 : 0,
@@ -22962,18 +22968,16 @@ var import_lucide_react17 = require("lucide-react");
22962
22968
  init_cn();
22963
22969
  init_table_width_model();
22964
22970
  var import_jsx_runtime33 = require("react/jsx-runtime");
22965
- var HANDLE_BASE_CLASS = cn(
22966
- "pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center rounded-md",
22967
- "bg-background/95 text-primary shadow-sm backdrop-blur-sm",
22968
- "transition-[color,background-color,box-shadow,transform] duration-150",
22969
- "hover:bg-primary hover:text-primary-foreground hover:shadow-md active:scale-95",
22970
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
22971
- );
22972
22971
  var EDGE_HANDLE_CLASS = cn(
22973
22972
  "pointer-events-auto absolute top-0 z-10 h-full w-2 touch-none cursor-col-resize bg-transparent p-0",
22974
22973
  "border-transparent transition-colors duration-150 hover:border-primary",
22975
22974
  "focus-visible:border-primary focus-visible:outline-none"
22976
22975
  );
22976
+ var CORNER_HANDLE_CLASS = cn(
22977
+ "pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center p-0",
22978
+ "text-primary/70 transition-[color,transform] duration-150 hover:text-primary active:scale-95",
22979
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
22980
+ );
22977
22981
  function formatTableResizeDimensionLabel({
22978
22982
  width,
22979
22983
  height,
@@ -23053,9 +23057,9 @@ function TableResizeHandles({
23053
23057
  title: `${resizeBothLabel}. ${ctrlHint}`,
23054
23058
  "data-table-resize-handle": "both",
23055
23059
  className: cn(
23056
- HANDLE_BASE_CLASS,
23057
- "bottom-[-28px] right-[-30px] h-6 w-6 cursor-nwse-resize",
23058
- active && "bg-primary text-primary-foreground shadow-md"
23060
+ CORNER_HANDLE_CLASS,
23061
+ "bottom-[-28px] right-0 h-6 w-6 cursor-nwse-resize",
23062
+ active && "text-primary"
23059
23063
  ),
23060
23064
  onDoubleClick: onFitWidth,
23061
23065
  onClick: (event) => {
@@ -23656,8 +23660,8 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
23656
23660
  updateTableResizePreview(pendingDimensions);
23657
23661
  setDocumentCursor(editorDocument, edge === "both" ? "nwse-resize" : "ew-resize");
23658
23662
  }, [editor, editorDocument, updateTableResizePreview]);
23659
- const fitTableToEditorWidth = import_react38.default.useCallback((event) => {
23660
- if (event.button !== 0 || dragStateRef.current) return;
23663
+ const fitTableToEditorWidth = import_react38.default.useCallback(() => {
23664
+ if (dragStateRef.current) return;
23661
23665
  const activeLayout = layoutRef.current;
23662
23666
  if (!activeLayout) return;
23663
23667
  const snapshot = createTableSizeSnapshot(
@@ -23668,8 +23672,6 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
23668
23672
  activeLayout.viewportWidth
23669
23673
  );
23670
23674
  if (!snapshot) return;
23671
- event.preventDefault();
23672
- event.stopPropagation();
23673
23675
  const didResize = applyTableSize(editor, snapshot, {
23674
23676
  width: Math.round(activeLayout.viewportWidth),
23675
23677
  height: snapshot.startHeight,
@@ -24057,6 +24059,11 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
24057
24059
  icon: import_lucide_react18.Paintbrush,
24058
24060
  onClick: openCellInspector
24059
24061
  }] : [],
24062
+ {
24063
+ label: t("tableMenu.fitToEditorWidth"),
24064
+ icon: import_lucide_react18.Minimize2,
24065
+ onClick: fitTableToEditorWidth
24066
+ },
24060
24067
  {
24061
24068
  label: t("tableMenu.alignLeft"),
24062
24069
  icon: import_lucide_react18.AlignLeft,
@@ -24121,7 +24128,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
24121
24128
  destructive: true
24122
24129
  }
24123
24130
  ];
24124
- }, [editor, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
24131
+ }, [editor, fitTableToEditorWidth, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
24125
24132
  const getRowHandleMenuItems = import_react38.default.useCallback((rowHandle) => [
24126
24133
  {
24127
24134
  label: t("tableMenu.addRowBefore"),
@@ -25532,80 +25539,12 @@ function useUEditorOutput({
25532
25539
 
25533
25540
  // src/components/UEditor/UEditor.tsx
25534
25541
  init_portal_context();
25535
-
25536
- // src/components/UEditor/use-wide-table-layout.ts
25537
- var import_react44 = __toESM(require("react"), 1);
25538
- init_table_dom_utils();
25539
- function useWideTableLayout(editor, enabled, widthBoundaryRef, editorShellRef, editorSurfaceRef) {
25540
- import_react44.default.useLayoutEffect(() => {
25541
- const boundary = widthBoundaryRef.current;
25542
- const shell = editorShellRef.current;
25543
- const surface = editorSurfaceRef.current;
25544
- if (!editor || !boundary || !shell || !surface) return;
25545
- const editorDocument = editor.view.dom.ownerDocument;
25546
- const editorWindow = editorDocument.defaultView;
25547
- if (!editorWindow) return;
25548
- const editorDom = editor.view.dom;
25549
- let frame = 0;
25550
- const resetWidths = () => {
25551
- shell.style.removeProperty("width");
25552
- editorDom.style.removeProperty("width");
25553
- };
25554
- const sync = () => {
25555
- frame = 0;
25556
- resetWidths();
25557
- if (!enabled || editor.isDestroyed) return;
25558
- const boundaryWidth = boundary.getBoundingClientRect().width || boundary.clientWidth;
25559
- const surfaceWidth = surface.getBoundingClientRect().width || surface.clientWidth;
25560
- if (boundaryWidth <= 0 || surfaceWidth <= 0) return;
25561
- editorDom.style.width = `${surfaceWidth}px`;
25562
- const shellRect = shell.getBoundingClientRect();
25563
- let requiredWidth = boundaryWidth;
25564
- editorDom.querySelectorAll("table").forEach((table) => {
25565
- const tableRect = table.getBoundingClientRect();
25566
- if (tableRect.width > 0) {
25567
- requiredWidth = Math.max(requiredWidth, tableRect.right - shellRect.left + 32);
25568
- return;
25569
- }
25570
- const widthBp = Number(table.getAttribute("data-table-width-bp"));
25571
- if (Number.isFinite(widthBp) && widthBp > 1e4) {
25572
- requiredWidth = Math.max(requiredWidth, surfaceWidth * widthBp / 1e4 + 32);
25573
- }
25574
- });
25575
- if (requiredWidth <= boundaryWidth + 1) {
25576
- editorDom.style.removeProperty("width");
25577
- return;
25578
- }
25579
- shell.style.width = `${Math.ceil(requiredWidth)}px`;
25580
- };
25581
- const schedule = () => {
25582
- if (frame) editorWindow.cancelAnimationFrame(frame);
25583
- frame = editorWindow.requestAnimationFrame(sync);
25584
- };
25585
- const resizeObserver = typeof editorWindow.ResizeObserver === "function" ? new editorWindow.ResizeObserver(schedule) : null;
25586
- resizeObserver?.observe(boundary);
25587
- editor.on("transaction", schedule);
25588
- surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
25589
- editorWindow.addEventListener("resize", schedule);
25590
- schedule();
25591
- return () => {
25592
- if (frame) editorWindow.cancelAnimationFrame(frame);
25593
- resizeObserver?.disconnect();
25594
- editor.off("transaction", schedule);
25595
- surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
25596
- editorWindow.removeEventListener("resize", schedule);
25597
- resetWidths();
25598
- };
25599
- }, [editor, editorShellRef, editorSurfaceRef, enabled, widthBoundaryRef]);
25600
- }
25601
-
25602
- // src/components/UEditor/UEditor.tsx
25603
25542
  var import_jsx_runtime38 = require("react/jsx-runtime");
25604
- var LazyMenuBar = import_react46.default.lazy(async () => {
25543
+ var LazyMenuBar = import_react45.default.lazy(async () => {
25605
25544
  const { MenuBar: MenuBar2 } = await Promise.resolve().then(() => (init_menu_bar(), menu_bar_exports));
25606
25545
  return { default: MenuBar2 };
25607
25546
  });
25608
- var UEditor = import_react46.default.forwardRef(({
25547
+ var UEditor = import_react45.default.forwardRef(({
25609
25548
  getPortalContainer,
25610
25549
  content = "",
25611
25550
  onChange,
@@ -25657,18 +25596,16 @@ var UEditor = import_react46.default.forwardRef(({
25657
25596
  }, ref) => {
25658
25597
  const t = useSmartTranslations("UEditor");
25659
25598
  const effectivePlaceholder = placeholder ?? t("placeholder");
25660
- const inFlightPrepareRef = (0, import_react46.useRef)(null);
25661
- const lastAppliedContentRef = (0, import_react46.useRef)(content ?? "");
25662
- const scheduledFormulaRecalculateRef = (0, import_react46.useRef)(false);
25663
- const pendingFormulaTextRecalculateRef = (0, import_react46.useRef)(false);
25664
- const editorInstanceRef = (0, import_react46.useRef)(null);
25665
- const formulaRangePickRef = (0, import_react46.useRef)(null);
25666
- const formulaRangeSurfaceRef = (0, import_react46.useRef)(null);
25667
- const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react46.default.useState(null);
25668
- const [isMenuBarVisible, setIsMenuBarVisible] = import_react46.default.useState(showMenuBar);
25669
- const widthBoundaryRef = (0, import_react46.useRef)(null);
25670
- const editorShellRef = (0, import_react46.useRef)(null);
25671
- (0, import_react46.useEffect)(() => {
25599
+ const inFlightPrepareRef = (0, import_react45.useRef)(null);
25600
+ const lastAppliedContentRef = (0, import_react45.useRef)(content ?? "");
25601
+ const scheduledFormulaRecalculateRef = (0, import_react45.useRef)(false);
25602
+ const pendingFormulaTextRecalculateRef = (0, import_react45.useRef)(false);
25603
+ const editorInstanceRef = (0, import_react45.useRef)(null);
25604
+ const formulaRangePickRef = (0, import_react45.useRef)(null);
25605
+ const formulaRangeSurfaceRef = (0, import_react45.useRef)(null);
25606
+ const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react45.default.useState(null);
25607
+ const [isMenuBarVisible, setIsMenuBarVisible] = import_react45.default.useState(showMenuBar);
25608
+ (0, import_react45.useEffect)(() => {
25672
25609
  setIsMenuBarVisible(showMenuBar);
25673
25610
  }, [showMenuBar]);
25674
25611
  const { flushOutputUpdates, scheduleOutputUpdate } = useUEditorOutput({
@@ -25677,7 +25614,7 @@ var UEditor = import_react46.default.forwardRef(({
25677
25614
  onJsonChange,
25678
25615
  outputDebounceMs
25679
25616
  });
25680
- const scheduleFormulaRecalculate = import_react46.default.useCallback((editor2, options) => {
25617
+ const scheduleFormulaRecalculate = import_react45.default.useCallback((editor2, options) => {
25681
25618
  if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
25682
25619
  if (!options?.force && isEditingTableFormulaText(editor2)) return;
25683
25620
  scheduledFormulaRecalculateRef.current = true;
@@ -25688,7 +25625,7 @@ var UEditor = import_react46.default.forwardRef(({
25688
25625
  }
25689
25626
  });
25690
25627
  }, []);
25691
- const resolvedUploadFile = (0, import_react46.useMemo)(() => {
25628
+ const resolvedUploadFile = (0, import_react45.useMemo)(() => {
25692
25629
  if (uploadFile) return uploadFile;
25693
25630
  if (uploadFileForSave) {
25694
25631
  return async (file) => {
@@ -25698,7 +25635,7 @@ var UEditor = import_react46.default.forwardRef(({
25698
25635
  }
25699
25636
  return uploadImage;
25700
25637
  }, [uploadFile, uploadFileForSave, uploadImage]);
25701
- const extensions = (0, import_react46.useMemo)(
25638
+ const extensions = (0, import_react45.useMemo)(
25702
25639
  () => [
25703
25640
  ...buildUEditorExtensions({
25704
25641
  getPortalContainer,
@@ -25719,11 +25656,11 @@ var UEditor = import_react46.default.forwardRef(({
25719
25656
  ],
25720
25657
  [getPortalContainer, effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, onImageUploadError, editable, fetchMetadata, extraExtensions]
25721
25658
  );
25722
- const syncFormulaRangeHighlight = import_react46.default.useCallback((pickState) => {
25659
+ const syncFormulaRangeHighlight = import_react45.default.useCallback((pickState) => {
25723
25660
  const container = formulaRangeSurfaceRef.current;
25724
25661
  setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
25725
25662
  }, []);
25726
- const editor = (0, import_react47.useEditor)({
25663
+ const editor = (0, import_react46.useEditor)({
25727
25664
  immediatelyRender: false,
25728
25665
  extensions,
25729
25666
  content,
@@ -25844,7 +25781,7 @@ var UEditor = import_react46.default.forwardRef(({
25844
25781
  queueMicrotask(flushOutputUpdates);
25845
25782
  }
25846
25783
  });
25847
- (0, import_react46.useEffect)(() => {
25784
+ (0, import_react45.useEffect)(() => {
25848
25785
  editorInstanceRef.current = editor;
25849
25786
  return () => {
25850
25787
  if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
@@ -25860,8 +25797,7 @@ var UEditor = import_react46.default.forwardRef(({
25860
25797
  apply: t("tableMenu.apply"),
25861
25798
  cancel: t("imageInput.cancelBtn")
25862
25799
  });
25863
- useWideTableLayout(editor, expandWideTables, widthBoundaryRef, editorShellRef, editorContentRef);
25864
- (0, import_react46.useImperativeHandle)(
25800
+ (0, import_react45.useImperativeHandle)(
25865
25801
  ref,
25866
25802
  () => ({
25867
25803
  editor,
@@ -25890,7 +25826,7 @@ var UEditor = import_react46.default.forwardRef(({
25890
25826
  }),
25891
25827
  [content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
25892
25828
  );
25893
- (0, import_react46.useEffect)(() => {
25829
+ (0, import_react45.useEffect)(() => {
25894
25830
  if (!editor) return;
25895
25831
  queueMicrotask(() => {
25896
25832
  if (!editor.isDestroyed) {
@@ -25898,7 +25834,7 @@ var UEditor = import_react46.default.forwardRef(({
25898
25834
  }
25899
25835
  });
25900
25836
  }, [editor]);
25901
- (0, import_react46.useEffect)(() => {
25837
+ (0, import_react45.useEffect)(() => {
25902
25838
  if (!editor) return;
25903
25839
  const nextContent = content ?? "";
25904
25840
  if (lastAppliedContentRef.current === nextContent) return;
@@ -25928,10 +25864,9 @@ var UEditor = import_react46.default.forwardRef(({
25928
25864
  }
25929
25865
  ) });
25930
25866
  }
25931
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { ref: widthBoundaryRef, "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
25867
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
25932
25868
  "div",
25933
25869
  {
25934
- ref: editorShellRef,
25935
25870
  className: cn(
25936
25871
  "group relative flex flex-col text-card-foreground",
25937
25872
  editable ? [
@@ -25946,7 +25881,7 @@ var UEditor = import_react46.default.forwardRef(({
25946
25881
  ),
25947
25882
  children: [
25948
25883
  editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(EditorUiRenderStateProvider, { editor, children: [
25949
- isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react46.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
25884
+ isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react45.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
25950
25885
  LazyMenuBar,
25951
25886
  {
25952
25887
  editor,
@@ -26004,7 +25939,7 @@ var UEditor = import_react46.default.forwardRef(({
26004
25939
  formulaRangeSurfaceRef.current = node;
26005
25940
  },
26006
25941
  className: cn(
26007
- "relative flex-1 overflow-y-auto",
25942
+ "relative flex-1 overflow-x-auto overflow-y-auto [scrollbar-width:thin] [scrollbar-color:hsl(var(--border))_transparent]",
26008
25943
  expandWideTables && "[&_.tableWrapper]:!overflow-visible [&_.tableWrapper]:!pb-0"
26009
25944
  ),
26010
25945
  style: {
@@ -26073,7 +26008,7 @@ var UEditor = import_react46.default.forwardRef(({
26073
26008
  }
26074
26009
  ),
26075
26010
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
26076
- import_react47.EditorContent,
26011
+ import_react46.EditorContent,
26077
26012
  {
26078
26013
  editor,
26079
26014
  className: "min-h-full"