@underverse-ui/underverse 2.0.15 → 2.0.17

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.15",
3
+ "version": "2.0.17",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 257,
6
6
  "exports": [
@@ -3444,6 +3444,8 @@ var EditorToolbar = ({
3444
3444
  const [showImageInput, setShowImageInput] = useState4(false);
3445
3445
  const [showLinkInput, setShowLinkInput] = useState4(false);
3446
3446
  const [isTableMenuOpen, setIsTableMenuOpen] = useState4(false);
3447
+ const [fontSizeDraft, setFontSizeDraft] = useState4("");
3448
+ const [isEditingFontSize, setIsEditingFontSize] = useState4(false);
3447
3449
  const fileInputRef = useRef4(null);
3448
3450
  const [isUploadingImage, setIsUploadingImage] = useState4(false);
3449
3451
  const [imageUploadError, setImageUploadError] = useState4(null);
@@ -3473,7 +3475,7 @@ var EditorToolbar = ({
3473
3475
  const availableLetterSpacings = React7.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
3474
3476
  const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
3475
3477
  const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
3476
- 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");
3477
3479
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
3478
3480
  const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
3479
3481
  const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
@@ -3485,6 +3487,12 @@ var EditorToolbar = ({
3485
3487
  const isMedium = variant === "medium";
3486
3488
  const isMediumFull = variant === "medium-full";
3487
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
+ };
3488
3496
  const insertImageFiles = async (files) => {
3489
3497
  if (files.length === 0) return;
3490
3498
  setIsUploadingImage(true);
@@ -3653,25 +3661,47 @@ var EditorToolbar = ({
3653
3661
  (isMediumFull || isFull) && /* @__PURE__ */ jsx7(
3654
3662
  DropdownMenu,
3655
3663
  {
3656
- trigger: /* @__PURE__ */ jsxs5(
3657
- ToolbarButton,
3658
- {
3659
- onClick: () => {
3660
- },
3661
- title: t("toolbar.fontSize"),
3662
- 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",
3663
- children: [
3664
- /* @__PURE__ */ jsx7("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
3665
- /* @__PURE__ */ jsx7(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
3666
- ]
3667
- }
3668
- ),
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
+ ] }),
3669
3696
  contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
3670
3697
  children: availableFontSizes.map((option) => /* @__PURE__ */ jsx7(
3671
3698
  DropdownMenuItem,
3672
3699
  {
3673
3700
  label: option.label,
3674
- onClick: () => editor.chain().focus().setFontSize(option.value).run(),
3701
+ onClick: () => {
3702
+ editor.chain().focus().setFontSize(option.value).run();
3703
+ setFontSizeDraft(option.label);
3704
+ },
3675
3705
  active: normalizeStyleValue(option.value) === activeFontSize
3676
3706
  },
3677
3707
  option.value
@@ -4628,4 +4658,4 @@ export {
4628
4658
  EditorToolbar,
4629
4659
  UEDITOR_PROSEMIRROR_CLASS_NAME
4630
4660
  };
4631
- //# sourceMappingURL=chunk-WEGE3MZ5.js.map
4661
+ //# sourceMappingURL=chunk-23VKHYEB.js.map