@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,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Modal_default
4
- } from "./chunk-D22TNGE5.js";
4
+ } from "./chunk-HEXF4EOB.js";
5
5
  import {
6
6
  DEFAULT_TABLE_ROW_HEIGHT,
7
7
  DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
@@ -21,7 +21,7 @@ import {
21
21
  sanitizeUEditorUrl,
22
22
  useDropdownMenuClose,
23
23
  useSharedEditorUiRenderState
24
- } from "./chunk-WEGE3MZ5.js";
24
+ } from "./chunk-23VKHYEB.js";
25
25
  import {
26
26
  cn,
27
27
  useSmartTranslations
@@ -945,4 +945,4 @@ var MenuBar = ({
945
945
  export {
946
946
  MenuBar
947
947
  };
948
- //# sourceMappingURL=menu-bar-YMEOEYJS.js.map
948
+ //# sourceMappingURL=menu-bar-7MPCNTHR.js.map
package/dist/ueditor.cjs CHANGED
@@ -7054,6 +7054,8 @@ var init_toolbar = __esm({
7054
7054
  const [showImageInput, setShowImageInput] = (0, import_react33.useState)(false);
7055
7055
  const [showLinkInput, setShowLinkInput] = (0, import_react33.useState)(false);
7056
7056
  const [isTableMenuOpen, setIsTableMenuOpen] = (0, import_react33.useState)(false);
7057
+ const [fontSizeDraft, setFontSizeDraft] = (0, import_react33.useState)("");
7058
+ const [isEditingFontSize, setIsEditingFontSize] = (0, import_react33.useState)(false);
7057
7059
  const fileInputRef = (0, import_react33.useRef)(null);
7058
7060
  const [isUploadingImage, setIsUploadingImage] = (0, import_react33.useState)(false);
7059
7061
  const [imageUploadError, setImageUploadError] = (0, import_react33.useState)(null);
@@ -7083,7 +7085,7 @@ var init_toolbar = __esm({
7083
7085
  const availableLetterSpacings = import_react33.default.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
7084
7086
  const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
7085
7087
  const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
7086
- const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
7088
+ const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? (currentFontSize.replace(/px$/i, "") || "13");
7087
7089
  const currentLineHeightLabel = availableLineHeights.find((option) => normalizeStyleValue(option.value) === currentLineHeight)?.label ?? t("toolbar.lineHeightDefault");
7088
7090
  const currentLetterSpacingLabel = availableLetterSpacings.find((option) => normalizeStyleValue(option.value) === currentLetterSpacing)?.label ?? t("toolbar.letterSpacingDefault");
7089
7091
  const defaultFontFamilyOption = availableFontFamilies.find((opt) => normalizeStyleValue(opt.value) === normalizeStyleValue(defaultFontFamily)) ?? availableFontFamilies[0];
@@ -7095,6 +7097,12 @@ var init_toolbar = __esm({
7095
7097
  const isMedium = variant === "medium";
7096
7098
  const isMediumFull = variant === "medium-full";
7097
7099
  const isFull = variant === "default" || variant === "full" || variant === "notion" || !variant;
7100
+ const applyFontSizeDraft = () => {
7101
+ const parsed = Number.parseFloat(fontSizeDraft);
7102
+ if (!Number.isFinite(parsed)) return;
7103
+ editor.chain().focus().setFontSize(`${parsed}px`).run();
7104
+ setFontSizeDraft(String(parsed));
7105
+ };
7098
7106
  const insertImageFiles = async (files) => {
7099
7107
  if (files.length === 0) return;
7100
7108
  setIsUploadingImage(true);
@@ -7263,25 +7271,47 @@ var init_toolbar = __esm({
7263
7271
  (isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
7264
7272
  DropdownMenu,
7265
7273
  {
7266
- trigger: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
7267
- ToolbarButton,
7268
- {
7269
- onClick: () => {
7270
- },
7271
- title: t("toolbar.fontSize"),
7272
- 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",
7273
- children: [
7274
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-xs font-normal leading-none", children: displayedFontSizeLabel }),
7275
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
7276
- ]
7277
- }
7278
- ),
7274
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime26.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: [
7275
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
7276
+ "input",
7277
+ {
7278
+ type: "number",
7279
+ step: 1,
7280
+ value: isEditingFontSize ? fontSizeDraft : displayedFontSizeLabel,
7281
+ onFocus: () => {
7282
+ setFontSizeDraft(displayedFontSizeLabel);
7283
+ setIsEditingFontSize(true);
7284
+ },
7285
+ onChange: (event) => setFontSizeDraft(event.target.value),
7286
+ onBlur: () => {
7287
+ applyFontSizeDraft();
7288
+ setIsEditingFontSize(false);
7289
+ },
7290
+ onMouseDown: (event) => event.stopPropagation(),
7291
+ onClick: (event) => event.stopPropagation(),
7292
+ onKeyDown: (event) => {
7293
+ event.stopPropagation();
7294
+ if (event.key === "Enter") {
7295
+ event.preventDefault();
7296
+ applyFontSizeDraft();
7297
+ setIsEditingFontSize(false);
7298
+ }
7299
+ },
7300
+ "aria-label": t("toolbar.fontSize"),
7301
+ 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"
7302
+ }
7303
+ ),
7304
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", "aria-label": t("toolbar.fontSize"), title: t("toolbar.fontSize"), className: "px-1 text-[#7B8184]", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3" }) })
7305
+ ] }),
7279
7306
  contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
7280
7307
  children: availableFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
7281
7308
  DropdownMenuItem,
7282
7309
  {
7283
7310
  label: option.label,
7284
- onClick: () => editor.chain().focus().setFontSize(option.value).run(),
7311
+ onClick: () => {
7312
+ editor.chain().focus().setFontSize(option.value).run();
7313
+ setFontSizeDraft(option.label);
7314
+ },
7285
7315
  active: normalizeStyleValue(option.value) === activeFontSize
7286
7316
  },
7287
7317
  option.value