@underverse-ui/underverse 2.0.14 → 2.0.16

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": "2.0.14",
3
+ "version": "2.0.16",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 257,
6
6
  "exports": [
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  EmojiPicker,
4
4
  EmojiPicker_default
5
- } from "./chunk-N2S6RI4Y.js";
6
- import "./chunk-DXLSCUYA.js";
5
+ } from "./chunk-HTGAV4IG.js";
6
+ import "./chunk-SKCO2GFM.js";
7
7
  import "./chunk-4TYW5K4J.js";
8
- import "./chunk-PV2G2XME.js";
8
+ import "./chunk-EPBYGZHZ.js";
9
9
  import "./chunk-NSBPE2FW.js";
10
10
  export {
11
11
  EmojiPicker,
12
12
  EmojiPicker_default as default
13
13
  };
14
- //# sourceMappingURL=EmojiPicker-CGMUDB4I.js.map
14
+ //# sourceMappingURL=EmojiPicker-3X2S7XPP.js.map
@@ -7,9 +7,11 @@ import {
7
7
  formControlSizeStyles,
8
8
  formControlValueClass,
9
9
  mergeRefs,
10
+ resolveUEditorPortalContainer,
10
11
  setRefValue,
11
- useSmartTranslations
12
- } from "./chunk-PV2G2XME.js";
12
+ useSmartTranslations,
13
+ useUEditorPortalContainerGetter
14
+ } from "./chunk-EPBYGZHZ.js";
13
15
 
14
16
  // src/contexts/UnderverseConfigContext.tsx
15
17
  import * as React from "react";
@@ -349,6 +351,10 @@ var Popover = ({
349
351
  const globalConfig = useUnderverseUIConfig();
350
352
  const resolvedBorderMode = borderMode ?? globalConfig.popover?.borderMode ?? globalConfig.borderMode;
351
353
  const isOpen = isControlled ? open : internalOpen;
354
+ const getPortalContainer = useUEditorPortalContainerGetter();
355
+ const portalContainer = isOpen ? resolveUEditorPortalContainer(getPortalContainer) : null;
356
+ const portalDocument = portalContainer?.ownerDocument ?? null;
357
+ const portalWindow = portalDocument?.defaultView ?? null;
352
358
  const setIsOpen = React2.useCallback(
353
359
  (next) => {
354
360
  if (!isControlled) setInternalOpen(next);
@@ -392,7 +398,10 @@ var Popover = ({
392
398
  placement,
393
399
  offset,
394
400
  padding,
395
- viewport: { width: window.innerWidth, height: window.innerHeight }
401
+ viewport: {
402
+ width: portalWindow?.innerWidth ?? window.innerWidth,
403
+ height: portalWindow?.innerHeight ?? window.innerHeight
404
+ }
396
405
  });
397
406
  const top = Math.round(next.top);
398
407
  const left = Math.round(next.left);
@@ -403,57 +412,58 @@ var Popover = ({
403
412
  panelEl.style.transformOrigin = getTransformOrigin(next.side, next.align);
404
413
  if (positionerEl.style.visibility !== "visible") positionerEl.style.visibility = "visible";
405
414
  if (positionerEl.style.pointerEvents !== "auto") positionerEl.style.pointerEvents = "auto";
406
- }, [placement, matchTriggerWidth, contentWidth]);
415
+ }, [placement, matchTriggerWidth, contentWidth, portalWindow]);
407
416
  React2.useLayoutEffect(() => {
408
- if (!isOpen) return;
417
+ if (!isOpen || !portalWindow) return;
409
418
  updatePosition();
410
419
  let raf1 = 0;
411
420
  let raf2 = 0;
412
- raf1 = window.requestAnimationFrame(() => {
421
+ raf1 = portalWindow.requestAnimationFrame(() => {
413
422
  updatePosition();
414
- raf2 = window.requestAnimationFrame(() => updatePosition());
423
+ raf2 = portalWindow.requestAnimationFrame(() => updatePosition());
415
424
  });
416
425
  return () => {
417
- cancelAnimationFrame(raf1);
418
- cancelAnimationFrame(raf2);
426
+ portalWindow.cancelAnimationFrame(raf1);
427
+ portalWindow.cancelAnimationFrame(raf2);
419
428
  };
420
- }, [isOpen, updatePosition]);
429
+ }, [isOpen, portalWindow, updatePosition]);
421
430
  React2.useEffect(() => {
422
- if (!isOpen) return;
431
+ if (!isOpen || !portalWindow) return;
423
432
  let raf = 0;
424
433
  const tick = () => {
425
434
  updatePosition();
426
- raf = window.requestAnimationFrame(tick);
435
+ raf = portalWindow.requestAnimationFrame(tick);
427
436
  };
428
- raf = window.requestAnimationFrame(tick);
429
- return () => window.cancelAnimationFrame(raf);
430
- }, [isOpen, updatePosition]);
437
+ raf = portalWindow.requestAnimationFrame(tick);
438
+ return () => portalWindow.cancelAnimationFrame(raf);
439
+ }, [isOpen, portalWindow, updatePosition]);
431
440
  React2.useEffect(() => {
432
- if (!isOpen) return;
441
+ if (!isOpen || !portalDocument || !portalWindow) return;
433
442
  let raf = 0;
434
443
  const handler = () => {
435
- cancelAnimationFrame(raf);
436
- raf = window.requestAnimationFrame(() => updatePosition());
444
+ portalWindow.cancelAnimationFrame(raf);
445
+ raf = portalWindow.requestAnimationFrame(() => updatePosition());
437
446
  };
438
447
  handler();
439
- window.addEventListener("resize", handler);
440
- window.addEventListener("scroll", handler, true);
441
- document.addEventListener("scroll", handler, true);
448
+ portalWindow.addEventListener("resize", handler);
449
+ portalWindow.addEventListener("scroll", handler, true);
450
+ portalDocument.addEventListener("scroll", handler, true);
442
451
  return () => {
443
- cancelAnimationFrame(raf);
444
- window.removeEventListener("resize", handler);
445
- window.removeEventListener("scroll", handler, true);
446
- document.removeEventListener("scroll", handler, true);
452
+ portalWindow.cancelAnimationFrame(raf);
453
+ portalWindow.removeEventListener("resize", handler);
454
+ portalWindow.removeEventListener("scroll", handler, true);
455
+ portalDocument.removeEventListener("scroll", handler, true);
447
456
  };
448
- }, [isOpen, updatePosition]);
457
+ }, [isOpen, portalDocument, portalWindow, updatePosition]);
449
458
  React2.useEffect(() => {
450
- if (!isOpen) return;
451
- if (typeof ResizeObserver === "undefined") return;
452
- const ro = new ResizeObserver(() => updatePosition());
459
+ if (!isOpen || !portalWindow) return;
460
+ const ResizeObserverCtor = portalWindow.ResizeObserver;
461
+ if (!ResizeObserverCtor) return;
462
+ const ro = new ResizeObserverCtor(() => updatePosition());
453
463
  if (positionerRef.current) ro.observe(positionerRef.current);
454
464
  if (triggerRef.current) ro.observe(triggerRef.current);
455
465
  return () => ro.disconnect();
456
- }, [isOpen, updatePosition]);
466
+ }, [isOpen, portalWindow, updatePosition]);
457
467
  React2.useLayoutEffect(() => {
458
468
  if (!isOpen) {
459
469
  lastAppliedRef.current = null;
@@ -461,7 +471,7 @@ var Popover = ({
461
471
  }
462
472
  }, [isOpen]);
463
473
  React2.useEffect(() => {
464
- if (!isOpen) return;
474
+ if (!isOpen || !portalDocument || !portalWindow) return;
465
475
  const handleClickOutside = (event) => {
466
476
  const target = event.target;
467
477
  const triggerEl = triggerRef.current;
@@ -469,7 +479,7 @@ var Popover = ({
469
479
  if (!triggerEl || !popoverEl) return;
470
480
  if (triggerEl.contains(target)) return;
471
481
  if (popoverEl.contains(target)) return;
472
- if (target instanceof Element && target.closest("[data-popover]")) return;
482
+ if (target instanceof portalWindow.Element && target.closest("[data-popover]")) return;
473
483
  setIsOpen(false);
474
484
  };
475
485
  const handleEscape = (event) => {
@@ -477,21 +487,19 @@ var Popover = ({
477
487
  setIsOpen(false);
478
488
  }
479
489
  };
480
- if (typeof document !== "undefined") {
481
- document.addEventListener("mousedown", handleClickOutside);
482
- document.addEventListener("keydown", handleEscape);
483
- return () => {
484
- document.removeEventListener("mousedown", handleClickOutside);
485
- document.removeEventListener("keydown", handleEscape);
486
- };
487
- }
488
- }, [isOpen, setIsOpen]);
490
+ portalDocument.addEventListener("mousedown", handleClickOutside);
491
+ portalDocument.addEventListener("keydown", handleEscape);
492
+ return () => {
493
+ portalDocument.removeEventListener("mousedown", handleClickOutside);
494
+ portalDocument.removeEventListener("keydown", handleEscape);
495
+ };
496
+ }, [isOpen, portalDocument, portalWindow, setIsOpen]);
489
497
  const handleTriggerClick = () => {
490
498
  if (!disabled) {
491
499
  setIsOpen(!isOpen);
492
500
  }
493
501
  };
494
- const popoverContent = isOpen && typeof window !== "undefined" ? createPortal(
502
+ const popoverContent = isOpen && portalContainer ? createPortal(
495
503
  /* @__PURE__ */ jsx2(
496
504
  "div",
497
505
  {
@@ -542,7 +550,7 @@ var Popover = ({
542
550
  )
543
551
  }
544
552
  ),
545
- document.body
553
+ portalContainer
546
554
  ) : null;
547
555
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
548
556
  (() => {
@@ -632,6 +640,7 @@ var DropdownMenu = ({
632
640
  const [activeIndex, setActiveIndex] = useResettingIndex(open);
633
641
  const parentMenu = React3.useContext(DropdownMenuContext);
634
642
  const hoverCloseTimeoutRef = React3.useRef(null);
643
+ const getPortalContainer = useUEditorPortalContainerGetter();
635
644
  const cancelHoverClose = React3.useCallback(() => {
636
645
  if (hoverCloseTimeoutRef.current === null) return;
637
646
  clearTimeout(hoverCloseTimeoutRef.current);
@@ -670,9 +679,9 @@ var DropdownMenu = ({
670
679
  React3.useEffect(() => {
671
680
  if (!open) return;
672
681
  const handleKeyNav = (e) => {
673
- const active = document.activeElement;
674
682
  const triggerEl = triggerRef.current;
675
683
  const menuEl = menuRef.current;
684
+ const active = menuEl?.ownerDocument.activeElement;
676
685
  if (!active || !triggerEl || !menuEl) return;
677
686
  const isInMenu = menuEl.contains(active);
678
687
  const isOnTrigger = triggerEl.contains(active);
@@ -699,9 +708,11 @@ var DropdownMenu = ({
699
708
  closeMenu();
700
709
  }
701
710
  };
702
- document.addEventListener("keydown", handleKeyNav, true);
711
+ const menuDocument = menuRef.current?.ownerDocument;
712
+ if (!menuDocument) return;
713
+ menuDocument.addEventListener("keydown", handleKeyNav, true);
703
714
  return () => {
704
- document.removeEventListener("keydown", handleKeyNav, true);
715
+ menuDocument.removeEventListener("keydown", handleKeyNav, true);
705
716
  };
706
717
  }, [open, activeIndex, closeMenu, focusMenuItem, getEnabledMenuItems]);
707
718
  const menuContext = React3.useMemo(
@@ -783,15 +794,17 @@ var DropdownMenu = ({
783
794
  triggerRef.current = node;
784
795
  }, [childRef]);
785
796
  const handleTriggerKeyDown = React3.useCallback((event) => {
797
+ const portalWindow = resolveUEditorPortalContainer(getPortalContainer)?.ownerDocument.defaultView;
798
+ const scheduleFrame = portalWindow?.requestAnimationFrame.bind(portalWindow) ?? requestAnimationFrame;
786
799
  if (!disabled) {
787
800
  if (event.key === "ArrowDown") {
788
801
  event.preventDefault();
789
802
  setOpen(true);
790
- requestAnimationFrame(() => focusMenuItem(0));
803
+ scheduleFrame(() => focusMenuItem(0));
791
804
  } else if (event.key === "ArrowUp") {
792
805
  event.preventDefault();
793
806
  setOpen(true);
794
- requestAnimationFrame(() => {
807
+ scheduleFrame(() => {
795
808
  const enabled = getEnabledMenuItems();
796
809
  focusMenuItem(enabled.length - 1);
797
810
  });
@@ -801,7 +814,7 @@ var DropdownMenu = ({
801
814
  }
802
815
  }
803
816
  triggerOnKeyDown?.(event);
804
- }, [disabled, focusMenuItem, getEnabledMenuItems, setOpen, triggerOnKeyDown]);
817
+ }, [disabled, focusMenuItem, getEnabledMenuItems, getPortalContainer, setOpen, triggerOnKeyDown]);
805
818
  const handleTriggerClick = React3.useCallback((event) => {
806
819
  if (openOnHover && !disabled) {
807
820
  cancelHoverClose();
@@ -2637,8 +2650,10 @@ function findTableRowNodeInfo(view, rowElement) {
2637
2650
  return null;
2638
2651
  }
2639
2652
  function resolveEventElement(target) {
2640
- if (target instanceof Element) return target;
2641
- if (target instanceof Node) return target.parentElement;
2653
+ const ownerDocument = target?.ownerDocument;
2654
+ const realm = ownerDocument?.defaultView;
2655
+ if (realm && target instanceof realm.Element) return target;
2656
+ if (realm && target instanceof realm.Node) return target.parentElement;
2642
2657
  return null;
2643
2658
  }
2644
2659
  function isPointOverRenderedText(root, clientX, clientY) {
@@ -2661,22 +2676,24 @@ function isPointOverRenderedText(root, clientX, clientY) {
2661
2676
  return false;
2662
2677
  }
2663
2678
  function getSelectionTableCell(view) {
2664
- const browserSelection = window.getSelection();
2679
+ const realm = view.dom.ownerDocument.defaultView;
2680
+ const browserSelection = realm?.getSelection();
2665
2681
  const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
2666
2682
  const anchorCell = anchorElement?.closest?.("th,td");
2667
- if (anchorCell instanceof HTMLElement) {
2683
+ if (realm && anchorCell instanceof realm.HTMLElement) {
2668
2684
  return anchorCell;
2669
2685
  }
2670
2686
  const { from } = view.state.selection;
2671
2687
  const domAtPos = view.domAtPos(from);
2672
2688
  const element = resolveEventElement(domAtPos.node);
2673
2689
  const cell = element?.closest?.("th,td");
2674
- return cell instanceof HTMLElement ? cell : null;
2690
+ return realm && cell instanceof realm.HTMLElement ? cell : null;
2675
2691
  }
2676
2692
  function resolveRowResizeTarget(cell, clientX, clientY) {
2677
2693
  const rect = cell.getBoundingClientRect();
2678
2694
  const row = cell.closest("tr");
2679
- if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
2695
+ const realm = cell.ownerDocument.defaultView;
2696
+ if (!realm || !(row instanceof realm.HTMLTableRowElement) || !(cell instanceof realm.HTMLTableCellElement)) {
2680
2697
  return null;
2681
2698
  }
2682
2699
  const distToBottom = Math.abs(clientY - rect.bottom);
@@ -2691,10 +2708,10 @@ function resolveRowResizeTarget(cell, clientX, clientY) {
2691
2708
  }
2692
2709
  if (distToTop <= TABLE_RESIZE_HIT_ZONE) {
2693
2710
  const prevRow = row.previousElementSibling;
2694
- if (prevRow instanceof HTMLTableRowElement) {
2711
+ if (prevRow instanceof realm.HTMLTableRowElement) {
2695
2712
  const cellIndex = cell.cellIndex;
2696
2713
  const prevCell = prevRow.children[cellIndex] ?? prevRow.firstElementChild;
2697
- if (prevCell instanceof HTMLTableCellElement) {
2714
+ if (prevCell instanceof realm.HTMLTableCellElement) {
2698
2715
  return { row: prevRow, cell: prevCell };
2699
2716
  }
2700
2717
  }
@@ -2704,7 +2721,8 @@ function resolveRowResizeTarget(cell, clientX, clientY) {
2704
2721
  function resolveColumnResizeTarget(cell, clientX, clientY) {
2705
2722
  const rect = cell.getBoundingClientRect();
2706
2723
  const row = cell.closest("tr");
2707
- if (!(row instanceof HTMLTableRowElement) || !(cell instanceof HTMLTableCellElement)) {
2724
+ const realm = cell.ownerDocument.defaultView;
2725
+ if (!realm || !(row instanceof realm.HTMLTableRowElement) || !(cell instanceof realm.HTMLTableCellElement)) {
2708
2726
  return null;
2709
2727
  }
2710
2728
  const distToRight = Math.abs(clientX - rect.right);
@@ -2719,7 +2737,7 @@ function resolveColumnResizeTarget(cell, clientX, clientY) {
2719
2737
  }
2720
2738
  if (distToLeft <= TABLE_RESIZE_HIT_ZONE) {
2721
2739
  const prevCell = cell.previousElementSibling;
2722
- if (prevCell instanceof HTMLTableCellElement) {
2740
+ if (prevCell instanceof realm.HTMLTableCellElement) {
2723
2741
  return { row, cell: prevCell };
2724
2742
  }
2725
2743
  }
@@ -3201,20 +3219,22 @@ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-run
3201
3219
  function getTableAnchorPos(editor) {
3202
3220
  const tableInfo = findTableNodeInfoFromState(editor.state);
3203
3221
  if (tableInfo) return editor.state.selection.from;
3204
- const selectionAnchor = resolveEventElement(window.getSelection()?.anchorNode ?? null);
3222
+ const editorDocument = editor.view.dom.ownerDocument;
3223
+ const editorWindow = editorDocument.defaultView;
3224
+ const selectionAnchor = resolveEventElement(editorWindow?.getSelection()?.anchorNode ?? null);
3205
3225
  const selectionCell = selectionAnchor?.closest?.("th,td");
3206
- if (selectionCell instanceof HTMLTableCellElement && editor.view.dom.contains(selectionCell)) {
3226
+ if (editorWindow && selectionCell instanceof editorWindow.HTMLTableCellElement && editor.view.dom.contains(selectionCell)) {
3207
3227
  return editor.view.posAtDOM(selectionCell, 0) + 1;
3208
3228
  }
3209
- const activeElement = document.activeElement instanceof Element ? document.activeElement : null;
3229
+ const activeElement = editorWindow && editorDocument.activeElement instanceof editorWindow.Element ? editorDocument.activeElement : null;
3210
3230
  const activeCell = activeElement?.closest?.("th,td");
3211
- if (activeCell instanceof HTMLTableCellElement && editor.view.dom.contains(activeCell)) {
3231
+ if (editorWindow && activeCell instanceof editorWindow.HTMLTableCellElement && editor.view.dom.contains(activeCell)) {
3212
3232
  return editor.view.posAtDOM(activeCell, 0) + 1;
3213
3233
  }
3214
3234
  const tables = editor.view.dom.querySelectorAll("table");
3215
3235
  if (tables.length !== 1) return null;
3216
3236
  const firstCell = tables[0]?.querySelector("th,td");
3217
- return firstCell instanceof HTMLTableCellElement ? editor.view.posAtDOM(firstCell, 0) + 1 : null;
3237
+ return editorWindow && firstCell instanceof editorWindow.HTMLTableCellElement ? editor.view.posAtDOM(firstCell, 0) + 1 : null;
3218
3238
  }
3219
3239
  var EDITOR_UI_ACTIVE_MARKS = [
3220
3240
  "blockquote",
@@ -3424,6 +3444,8 @@ var EditorToolbar = ({
3424
3444
  const [showImageInput, setShowImageInput] = useState4(false);
3425
3445
  const [showLinkInput, setShowLinkInput] = useState4(false);
3426
3446
  const [isTableMenuOpen, setIsTableMenuOpen] = useState4(false);
3447
+ const [fontSizeDraft, setFontSizeDraft] = useState4("");
3448
+ const [isEditingFontSize, setIsEditingFontSize] = useState4(false);
3427
3449
  const fileInputRef = useRef4(null);
3428
3450
  const [isUploadingImage, setIsUploadingImage] = useState4(false);
3429
3451
  const [imageUploadError, setImageUploadError] = useState4(null);
@@ -3453,7 +3475,7 @@ var EditorToolbar = ({
3453
3475
  const availableLetterSpacings = React7.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
3454
3476
  const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
3455
3477
  const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
3456
- const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
3478
+ const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? (currentFontSize.replace(/px$/i, "") || "13");
3457
3479
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
3458
3480
  const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
3459
3481
  const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
@@ -3465,6 +3487,12 @@ var EditorToolbar = ({
3465
3487
  const isMedium = variant === "medium";
3466
3488
  const isMediumFull = variant === "medium-full";
3467
3489
  const isFull = variant === "default" || variant === "full" || variant === "notion" || !variant;
3490
+ const applyFontSizeDraft = () => {
3491
+ const parsed = Number.parseFloat(fontSizeDraft);
3492
+ if (!Number.isFinite(parsed)) return;
3493
+ editor.chain().focus().setFontSize(`${parsed}px`).run();
3494
+ setFontSizeDraft(String(parsed));
3495
+ };
3468
3496
  const insertImageFiles = async (files) => {
3469
3497
  if (files.length === 0) return;
3470
3498
  setIsUploadingImage(true);
@@ -3633,25 +3661,47 @@ var EditorToolbar = ({
3633
3661
  (isMediumFull || isFull) && /* @__PURE__ */ jsx7(
3634
3662
  DropdownMenu,
3635
3663
  {
3636
- trigger: /* @__PURE__ */ jsxs5(
3637
- ToolbarButton,
3638
- {
3639
- onClick: () => {
3640
- },
3641
- title: t("toolbar.fontSize"),
3642
- 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",
3643
- children: [
3644
- /* @__PURE__ */ jsx7("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
3645
- /* @__PURE__ */ jsx7(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
3646
- ]
3647
- }
3648
- ),
3664
+ trigger: /* @__PURE__ */ jsxs5("div", { className: "flex h-7 w-14 items-center rounded-md border border-[rgba(196,197,213,0.6)] bg-white text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] dark:bg-background dark:text-foreground", children: [
3665
+ /* @__PURE__ */ jsx7(
3666
+ "input",
3667
+ {
3668
+ type: "number",
3669
+ step: 1,
3670
+ value: isEditingFontSize ? fontSizeDraft : displayedFontSizeLabel,
3671
+ onFocus: () => {
3672
+ setFontSizeDraft(displayedFontSizeLabel);
3673
+ setIsEditingFontSize(true);
3674
+ },
3675
+ onChange: (event) => setFontSizeDraft(event.target.value),
3676
+ onBlur: () => {
3677
+ applyFontSizeDraft();
3678
+ setIsEditingFontSize(false);
3679
+ },
3680
+ onMouseDown: (event) => event.stopPropagation(),
3681
+ onClick: (event) => event.stopPropagation(),
3682
+ onKeyDown: (event) => {
3683
+ event.stopPropagation();
3684
+ if (event.key === "Enter") {
3685
+ event.preventDefault();
3686
+ applyFontSizeDraft();
3687
+ setIsEditingFontSize(false);
3688
+ }
3689
+ },
3690
+ "aria-label": t("toolbar.fontSize"),
3691
+ className: "min-w-0 flex-1 bg-transparent px-2 text-xs font-normal leading-none outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
3692
+ }
3693
+ ),
3694
+ /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": t("toolbar.fontSize"), title: t("toolbar.fontSize"), className: "px-1 text-[#7B8184]", children: /* @__PURE__ */ jsx7(FigmaChevronDownIcon, { className: "h-3 w-3" }) })
3695
+ ] }),
3649
3696
  contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
3650
3697
  children: availableFontSizes.map((option) => /* @__PURE__ */ jsx7(
3651
3698
  DropdownMenuItem,
3652
3699
  {
3653
3700
  label: option.label,
3654
- onClick: () => editor.chain().focus().setFontSize(option.value).run(),
3701
+ onClick: () => {
3702
+ editor.chain().focus().setFontSize(option.value).run();
3703
+ setFontSizeDraft(option.label);
3704
+ },
3655
3705
  active: normalizeStyleValue(option.value) === activeFontSize
3656
3706
  },
3657
3707
  option.value
@@ -4608,4 +4658,4 @@ export {
4608
4658
  EditorToolbar,
4609
4659
  UEDITOR_PROSEMIRROR_CLASS_NAME
4610
4660
  };
4611
- //# sourceMappingURL=chunk-3Q5EE2ZA.js.map
4661
+ //# sourceMappingURL=chunk-23VKHYEB.js.map