@underverse-ui/underverse 2.0.15 → 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,7 +1,7 @@
1
1
  import {
2
2
  getPanelBorderRadiusClass,
3
3
  useUnderverseUIConfig
4
- } from "./chunk-WEGE3MZ5.js";
4
+ } from "./chunk-23VKHYEB.js";
5
5
  import {
6
6
  cn,
7
7
  useGlobalI18n
@@ -196,4 +196,4 @@ var Modal_default = Modal;
196
196
  export {
197
197
  Modal_default
198
198
  };
199
- //# sourceMappingURL=chunk-D22TNGE5.js.map
199
+ //# sourceMappingURL=chunk-HEXF4EOB.js.map
@@ -55,7 +55,7 @@ import {
55
55
  sanitizeUEditorUrl,
56
56
  useEditorColors,
57
57
  useSharedEditorUiRenderState
58
- } from "./chunk-WEGE3MZ5.js";
58
+ } from "./chunk-23VKHYEB.js";
59
59
  import {
60
60
  Tooltip,
61
61
  UEditorPortalProvider,
@@ -14504,7 +14504,7 @@ function useUEditorOutput({
14504
14504
  // src/components/UEditor/UEditor.tsx
14505
14505
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
14506
14506
  var LazyMenuBar = React15.lazy(async () => {
14507
- const { MenuBar } = await import("./menu-bar-YMEOEYJS.js");
14507
+ const { MenuBar } = await import("./menu-bar-7MPCNTHR.js");
14508
14508
  return { default: MenuBar };
14509
14509
  });
14510
14510
  var UEditor = React15.forwardRef(({
@@ -14973,4 +14973,4 @@ export {
14973
14973
  prepareUEditorContentForSave,
14974
14974
  UEditor_default
14975
14975
  };
14976
- //# sourceMappingURL=chunk-NWVDNVLR.js.map
14976
+ //# sourceMappingURL=chunk-YM56RXIZ.js.map
package/dist/index.cjs CHANGED
@@ -7472,6 +7472,8 @@ var init_toolbar = __esm({
7472
7472
  const [showImageInput, setShowImageInput] = (0, import_react73.useState)(false);
7473
7473
  const [showLinkInput, setShowLinkInput] = (0, import_react73.useState)(false);
7474
7474
  const [isTableMenuOpen, setIsTableMenuOpen] = (0, import_react73.useState)(false);
7475
+ const [fontSizeDraft, setFontSizeDraft] = (0, import_react73.useState)("");
7476
+ const [isEditingFontSize, setIsEditingFontSize] = (0, import_react73.useState)(false);
7475
7477
  const fileInputRef = (0, import_react73.useRef)(null);
7476
7478
  const [isUploadingImage, setIsUploadingImage] = (0, import_react73.useState)(false);
7477
7479
  const [imageUploadError, setImageUploadError] = (0, import_react73.useState)(null);
@@ -7501,7 +7503,7 @@ var init_toolbar = __esm({
7501
7503
  const availableLetterSpacings = import_react73.default.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
7502
7504
  const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
7503
7505
  const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
7504
- const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
7506
+ const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? (currentFontSize.replace(/px$/i, "") || "13");
7505
7507
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
7506
7508
  const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
7507
7509
  const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
@@ -7513,6 +7515,12 @@ var init_toolbar = __esm({
7513
7515
  const isMedium = variant === "medium";
7514
7516
  const isMediumFull = variant === "medium-full";
7515
7517
  const isFull = variant === "default" || variant === "full" || variant === "notion" || !variant;
7518
+ const applyFontSizeDraft = () => {
7519
+ const parsed = Number.parseFloat(fontSizeDraft);
7520
+ if (!Number.isFinite(parsed)) return;
7521
+ editor.chain().focus().setFontSize(`${parsed}px`).run();
7522
+ setFontSizeDraft(String(parsed));
7523
+ };
7516
7524
  const insertImageFiles = async (files) => {
7517
7525
  if (files.length === 0) return;
7518
7526
  setIsUploadingImage(true);
@@ -7681,25 +7689,47 @@ var init_toolbar = __esm({
7681
7689
  (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
7682
7690
  DropdownMenu,
7683
7691
  {
7684
- trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
7685
- ToolbarButton,
7686
- {
7687
- onClick: () => {
7688
- },
7689
- title: t("toolbar.fontSize"),
7690
- 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",
7691
- children: [
7692
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
7693
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7694
- ]
7695
- }
7696
- ),
7692
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("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: [
7693
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
7694
+ "input",
7695
+ {
7696
+ type: "number",
7697
+ step: 1,
7698
+ value: isEditingFontSize ? fontSizeDraft : displayedFontSizeLabel,
7699
+ onFocus: () => {
7700
+ setFontSizeDraft(displayedFontSizeLabel);
7701
+ setIsEditingFontSize(true);
7702
+ },
7703
+ onChange: (event) => setFontSizeDraft(event.target.value),
7704
+ onBlur: () => {
7705
+ applyFontSizeDraft();
7706
+ setIsEditingFontSize(false);
7707
+ },
7708
+ onMouseDown: (event) => event.stopPropagation(),
7709
+ onClick: (event) => event.stopPropagation(),
7710
+ onKeyDown: (event) => {
7711
+ event.stopPropagation();
7712
+ if (event.key === "Enter") {
7713
+ event.preventDefault();
7714
+ applyFontSizeDraft();
7715
+ setIsEditingFontSize(false);
7716
+ }
7717
+ },
7718
+ "aria-label": t("toolbar.fontSize"),
7719
+ 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"
7720
+ }
7721
+ ),
7722
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", "aria-label": t("toolbar.fontSize"), title: t("toolbar.fontSize"), className: "px-1 text-[#7B8184]", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3" }) })
7723
+ ] }),
7697
7724
  contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
7698
7725
  children: availableFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
7699
7726
  DropdownMenuItem,
7700
7727
  {
7701
7728
  label: option.label,
7702
- onClick: () => editor.chain().focus().setFontSize(option.value).run(),
7729
+ onClick: () => {
7730
+ editor.chain().focus().setFontSize(option.value).run();
7731
+ setFontSizeDraft(option.label);
7732
+ },
7703
7733
  active: normalizeStyleValue(option.value) === activeFontSize
7704
7734
  },
7705
7735
  option.value