@underverse-ui/underverse 1.0.88 → 1.0.89
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.
- package/api-reference.json +1 -1
- package/dist/index.cjs +25 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +122 -112
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -543,7 +543,7 @@ var Checkbox = React3.forwardRef(
|
|
|
543
543
|
Checkbox.displayName = "Checkbox";
|
|
544
544
|
|
|
545
545
|
// src/components/Input.tsx
|
|
546
|
-
import React8, { forwardRef as forwardRef3, useCallback as useCallback4, useId, useRef as useRef2, useState as
|
|
546
|
+
import React8, { forwardRef as forwardRef3, useCallback as useCallback4, useId, useRef as useRef2, useState as useState4 } from "react";
|
|
547
547
|
|
|
548
548
|
// src/hooks/useSmartTranslations.tsx
|
|
549
549
|
import * as React6 from "react";
|
|
@@ -1796,40 +1796,48 @@ function getEnvironmentLocale(fallback) {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
return fallback;
|
|
1798
1798
|
}
|
|
1799
|
-
function getExternalLocaleFallback(internalLocale) {
|
|
1800
|
-
if (internalLocale !== "en") {
|
|
1801
|
-
return internalLocale;
|
|
1802
|
-
}
|
|
1803
|
-
return getEnvironmentLocale(internalLocale);
|
|
1804
|
-
}
|
|
1805
1799
|
function useSmartTranslations(namespace) {
|
|
1806
1800
|
const forceInternal = React6.useContext(ForceInternalContext);
|
|
1807
1801
|
const nextIntlBridge = useNextIntlBridge();
|
|
1808
1802
|
const internalT = useUnderverseTranslations(namespace);
|
|
1809
1803
|
const internalLocale = useUnderverseLocale();
|
|
1804
|
+
const [environmentLocale, setEnvironmentLocale] = React6.useState(null);
|
|
1805
|
+
React6.useEffect(() => {
|
|
1806
|
+
if (forceInternal) return;
|
|
1807
|
+
if (nextIntlBridge) return;
|
|
1808
|
+
if (internalLocale !== "en") return;
|
|
1809
|
+
const detected = getEnvironmentLocale(internalLocale);
|
|
1810
|
+
if (detected !== internalLocale) {
|
|
1811
|
+
setEnvironmentLocale(detected);
|
|
1812
|
+
}
|
|
1813
|
+
}, [forceInternal, internalLocale, nextIntlBridge]);
|
|
1810
1814
|
if (forceInternal) {
|
|
1811
1815
|
return internalT;
|
|
1812
1816
|
}
|
|
1813
|
-
const resolvedLocale = nextIntlBridge?.locale ?? getExternalLocaleFallback(internalLocale);
|
|
1814
1817
|
return (key) => {
|
|
1818
|
+
const primaryLocale = nextIntlBridge?.locale ?? internalLocale;
|
|
1819
|
+
const fallbackLocale = environmentLocale && environmentLocale !== primaryLocale ? environmentLocale : null;
|
|
1815
1820
|
let translated = null;
|
|
1816
1821
|
if (nextIntlBridge) {
|
|
1817
1822
|
const nextIntlResult = nextIntlBridge.translate(namespace, key);
|
|
1818
1823
|
translated = nextIntlResult.translated;
|
|
1819
1824
|
}
|
|
1820
|
-
const
|
|
1821
|
-
const
|
|
1825
|
+
const localizedDefault = getUnderverseDefaultTranslation(primaryLocale, namespace, key);
|
|
1826
|
+
const fallbackLocalizedDefault = fallbackLocale ? getUnderverseDefaultTranslation(fallbackLocale, namespace, key) : key;
|
|
1822
1827
|
const englishDefault = getUnderverseDefaultTranslation("en", namespace, key);
|
|
1823
1828
|
const internalValue = internalT(key);
|
|
1824
|
-
if (translated && !isUnresolvedTranslation(translated, namespace, key) && !(
|
|
1829
|
+
if (translated && !isUnresolvedTranslation(translated, namespace, key) && !(primaryLocale !== "en" && localizedDefault !== englishDefault && translated === englishDefault)) {
|
|
1825
1830
|
return translated;
|
|
1826
1831
|
}
|
|
1827
|
-
if (internalLocale ===
|
|
1832
|
+
if (internalLocale === primaryLocale && internalValue !== key) {
|
|
1828
1833
|
return internalValue;
|
|
1829
1834
|
}
|
|
1830
1835
|
if (localizedDefault !== key) {
|
|
1831
1836
|
return localizedDefault;
|
|
1832
1837
|
}
|
|
1838
|
+
if (fallbackLocalizedDefault !== key) {
|
|
1839
|
+
return fallbackLocalizedDefault;
|
|
1840
|
+
}
|
|
1833
1841
|
if (internalValue !== key) {
|
|
1834
1842
|
return internalValue;
|
|
1835
1843
|
}
|
|
@@ -1843,14 +1851,14 @@ function useSmartLocale() {
|
|
|
1843
1851
|
if (forceInternal) {
|
|
1844
1852
|
return internalLocale;
|
|
1845
1853
|
}
|
|
1846
|
-
return nextIntlBridge?.locale ??
|
|
1854
|
+
return nextIntlBridge?.locale ?? internalLocale;
|
|
1847
1855
|
}
|
|
1848
1856
|
|
|
1849
1857
|
// src/components/Input.tsx
|
|
1850
1858
|
import { Eye, EyeOff, Search, X, AlertCircle, CheckCircle, Loader2 } from "lucide-react";
|
|
1851
1859
|
|
|
1852
1860
|
// src/components/OverlayScrollbarProvider.tsx
|
|
1853
|
-
import { createContext as createContext4, useContext as useContext4, useEffect, useMemo as useMemo2 } from "react";
|
|
1861
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
1854
1862
|
import { OverlayScrollbars } from "overlayscrollbars";
|
|
1855
1863
|
|
|
1856
1864
|
// src/utils/overlay-scrollbar-controller.ts
|
|
@@ -2068,7 +2076,7 @@ function useOverlayScrollbarTarget(targetRef, options = {}) {
|
|
|
2068
2076
|
}),
|
|
2069
2077
|
[enabled, theme, visibility, autoHide, autoHideDelay, dragScroll, clickScroll, exclude]
|
|
2070
2078
|
);
|
|
2071
|
-
|
|
2079
|
+
useEffect2(() => {
|
|
2072
2080
|
if (typeof window === "undefined") return;
|
|
2073
2081
|
const target = targetRef.current;
|
|
2074
2082
|
if (!target) return;
|
|
@@ -2122,9 +2130,9 @@ var Input = forwardRef3(
|
|
|
2122
2130
|
rightAddon,
|
|
2123
2131
|
...rest
|
|
2124
2132
|
}, ref) => {
|
|
2125
|
-
const [localError, setLocalError] =
|
|
2126
|
-
const [showPassword, setShowPassword] =
|
|
2127
|
-
const [isFocused, setIsFocused] =
|
|
2133
|
+
const [localError, setLocalError] = useState4(error);
|
|
2134
|
+
const [showPassword, setShowPassword] = useState4(false);
|
|
2135
|
+
const [isFocused, setIsFocused] = useState4(false);
|
|
2128
2136
|
const tv = useSmartTranslations("ValidationInput");
|
|
2129
2137
|
const autoId = useId();
|
|
2130
2138
|
const needsId = !!(label || description || hint || error);
|
|
@@ -2388,7 +2396,7 @@ var Input = forwardRef3(
|
|
|
2388
2396
|
Input.displayName = "Input";
|
|
2389
2397
|
var SearchInput = forwardRef3(
|
|
2390
2398
|
({ onSearch, searchDelay = 300, placeholder = "Search\u2026", ...props }, ref) => {
|
|
2391
|
-
const [searchValue, setSearchValue] =
|
|
2399
|
+
const [searchValue, setSearchValue] = useState4(props.value || "");
|
|
2392
2400
|
React8.useEffect(() => {
|
|
2393
2401
|
if (!onSearch) return;
|
|
2394
2402
|
const timer = setTimeout(() => {
|
|
@@ -2601,7 +2609,7 @@ var Textarea = forwardRef3(
|
|
|
2601
2609
|
maxLength,
|
|
2602
2610
|
...props
|
|
2603
2611
|
}, ref) => {
|
|
2604
|
-
const [isFocused, setIsFocused] =
|
|
2612
|
+
const [isFocused, setIsFocused] = useState4(false);
|
|
2605
2613
|
const textareaRef = useRef2(null);
|
|
2606
2614
|
const charCount = typeof value === "string" ? value.length : 0;
|
|
2607
2615
|
useOverlayScrollbarTarget(textareaRef, { enabled: useOverlayScrollbar });
|
|
@@ -2704,7 +2712,7 @@ Textarea.displayName = "Textarea";
|
|
|
2704
2712
|
var Input_default = Input;
|
|
2705
2713
|
|
|
2706
2714
|
// src/components/EmojiPicker.tsx
|
|
2707
|
-
import { useEffect as
|
|
2715
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState6 } from "react";
|
|
2708
2716
|
import { Search as Search2, X as X2, Smile, Leaf, Utensils, Dumbbell, Lightbulb, Hash, Flag } from "lucide-react";
|
|
2709
2717
|
|
|
2710
2718
|
// src/components/Tooltip.tsx
|
|
@@ -3788,8 +3796,8 @@ var EmojiPicker = ({
|
|
|
3788
3796
|
chrome = "standalone"
|
|
3789
3797
|
}) => {
|
|
3790
3798
|
const t = useSmartTranslations("UEditor");
|
|
3791
|
-
const [search, setSearch] =
|
|
3792
|
-
const [activeCategory, setActiveCategory] =
|
|
3799
|
+
const [search, setSearch] = useState6("");
|
|
3800
|
+
const [activeCategory, setActiveCategory] = useState6(EMOJI_LIST[0]?.id || "");
|
|
3793
3801
|
const scrollContainerRef = useRef4(null);
|
|
3794
3802
|
const categoryRefs = useRef4({});
|
|
3795
3803
|
const isUserScrolling = useRef4(false);
|
|
@@ -3809,7 +3817,7 @@ var EmojiPicker = ({
|
|
|
3809
3817
|
emojis: category.emojis.filter((emoji) => emoji.name.toLowerCase().includes(query) || emoji.emoji.includes(search))
|
|
3810
3818
|
})).filter((category) => category.emojis.length > 0);
|
|
3811
3819
|
}, [search]);
|
|
3812
|
-
|
|
3820
|
+
useEffect4(() => {
|
|
3813
3821
|
if (search) return;
|
|
3814
3822
|
const container = scrollContainerRef.current;
|
|
3815
3823
|
if (!container) return;
|
|
@@ -3837,7 +3845,7 @@ var EmojiPicker = ({
|
|
|
3837
3845
|
container.addEventListener("scroll", handleScroll);
|
|
3838
3846
|
return () => container.removeEventListener("scroll", handleScroll);
|
|
3839
3847
|
}, [activeCategory, search]);
|
|
3840
|
-
|
|
3848
|
+
useEffect4(() => {
|
|
3841
3849
|
isUserScrolling.current = true;
|
|
3842
3850
|
}, []);
|
|
3843
3851
|
const renderEmojiCategory = (category, assignRef2 = false) => /* @__PURE__ */ jsxs7(
|
|
@@ -3939,7 +3947,7 @@ var EmojiPicker = ({
|
|
|
3939
3947
|
var EmojiPicker_default = EmojiPicker;
|
|
3940
3948
|
|
|
3941
3949
|
// src/components/TagInput.tsx
|
|
3942
|
-
import { forwardRef as forwardRef4, useState as
|
|
3950
|
+
import { forwardRef as forwardRef4, useState as useState7, useRef as useRef5, useId as useId3 } from "react";
|
|
3943
3951
|
import { X as X3, Search as Search3, Loader2 as Loader22 } from "lucide-react";
|
|
3944
3952
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3945
3953
|
var TagInput = forwardRef4(
|
|
@@ -3962,8 +3970,8 @@ var TagInput = forwardRef4(
|
|
|
3962
3970
|
maxVisibleTags,
|
|
3963
3971
|
labels
|
|
3964
3972
|
}, ref) => {
|
|
3965
|
-
const [inputValue, setInputValue] =
|
|
3966
|
-
const [isFocused, setIsFocused] =
|
|
3973
|
+
const [inputValue, setInputValue] = useState7("");
|
|
3974
|
+
const [isFocused, setIsFocused] = useState7(false);
|
|
3967
3975
|
const inputRef = useRef5(null);
|
|
3968
3976
|
const autoId = useId3();
|
|
3969
3977
|
const inputId = `tag-input-${autoId}`;
|
|
@@ -3972,7 +3980,7 @@ var TagInput = forwardRef4(
|
|
|
3972
3980
|
const searchLabel = labels?.search ?? "Search";
|
|
3973
3981
|
const clearAllLabel = labels?.clearAll ?? "Clear all";
|
|
3974
3982
|
const isMaxReached = maxTags !== void 0 && value.length >= maxTags;
|
|
3975
|
-
const [isExpanded, setIsExpanded] =
|
|
3983
|
+
const [isExpanded, setIsExpanded] = useState7(false);
|
|
3976
3984
|
const hiddenCount = maxVisibleTags !== void 0 && !isExpanded ? Math.max(0, value.length - maxVisibleTags) : 0;
|
|
3977
3985
|
const visibleTags = hiddenCount > 0 ? value.slice(0, maxVisibleTags) : value;
|
|
3978
3986
|
const moreLabel = labels?.moreCount?.replace("{count}", String(hiddenCount)) ?? `+${hiddenCount} more`;
|
|
@@ -5231,7 +5239,7 @@ var Modal = ({
|
|
|
5231
5239
|
var Modal_default = Modal;
|
|
5232
5240
|
|
|
5233
5241
|
// src/components/Toast.tsx
|
|
5234
|
-
import { createContext as createContext5, useContext as useContext5, useState as
|
|
5242
|
+
import { createContext as createContext5, useContext as useContext5, useState as useState10, useCallback as useCallback6, useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
5235
5243
|
import { X as X6, CheckCircle as CheckCircle2, AlertCircle as AlertCircle2, Info, AlertTriangle as AlertTriangle2 } from "lucide-react";
|
|
5236
5244
|
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5237
5245
|
var ToastContext = createContext5(void 0);
|
|
@@ -5243,7 +5251,7 @@ var useToast = () => {
|
|
|
5243
5251
|
return context;
|
|
5244
5252
|
};
|
|
5245
5253
|
var ToastProvider = ({ children, position = "top-right", maxToasts = 5 }) => {
|
|
5246
|
-
const [toasts, setToasts] =
|
|
5254
|
+
const [toasts, setToasts] = useState10([]);
|
|
5247
5255
|
const idRef = useRef7(0);
|
|
5248
5256
|
const removeToast = useCallback6((id) => {
|
|
5249
5257
|
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
@@ -5273,9 +5281,9 @@ var ToastProvider = ({ children, position = "top-right", maxToasts = 5 }) => {
|
|
|
5273
5281
|
] });
|
|
5274
5282
|
};
|
|
5275
5283
|
var ToastComponent = ({ toast, onRemove }) => {
|
|
5276
|
-
const [isVisible, setIsVisible] =
|
|
5277
|
-
const [progress, setProgress] =
|
|
5278
|
-
const [paused, setPaused] =
|
|
5284
|
+
const [isVisible, setIsVisible] = useState10(true);
|
|
5285
|
+
const [progress, setProgress] = useState10(100);
|
|
5286
|
+
const [paused, setPaused] = useState10(false);
|
|
5279
5287
|
const total = toast.duration && toast.duration > 0 ? toast.duration : 5e3;
|
|
5280
5288
|
const endTsRef = useRef7(0);
|
|
5281
5289
|
const remainingRef = useRef7(total);
|
|
@@ -5284,7 +5292,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
5284
5292
|
setIsVisible(false);
|
|
5285
5293
|
setTimeout(() => onRemove(toast.id), 150);
|
|
5286
5294
|
}, [onRemove, toast.id]);
|
|
5287
|
-
|
|
5295
|
+
useEffect6(() => {
|
|
5288
5296
|
if (toast.duration === 0) return;
|
|
5289
5297
|
remainingRef.current = total;
|
|
5290
5298
|
endTsRef.current = Date.now() + total;
|
|
@@ -5408,7 +5416,7 @@ import * as React18 from "react";
|
|
|
5408
5416
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5409
5417
|
|
|
5410
5418
|
// src/utils/animations.ts
|
|
5411
|
-
import { useEffect as
|
|
5419
|
+
import { useEffect as useEffect7 } from "react";
|
|
5412
5420
|
var shadcnAnimationStyles = `
|
|
5413
5421
|
/* ============================================
|
|
5414
5422
|
* DROPDOWN / POPOVER ANIMATIONS
|
|
@@ -5586,7 +5594,7 @@ function ensureAnimationStylesInjected() {
|
|
|
5586
5594
|
}
|
|
5587
5595
|
}
|
|
5588
5596
|
function useShadCNAnimations() {
|
|
5589
|
-
|
|
5597
|
+
useEffect7(() => {
|
|
5590
5598
|
ensureAnimationStylesInjected();
|
|
5591
5599
|
}, []);
|
|
5592
5600
|
}
|
|
@@ -6141,7 +6149,7 @@ var SidebarSheet = ({ navigation, children, ...props }) => {
|
|
|
6141
6149
|
};
|
|
6142
6150
|
|
|
6143
6151
|
// src/components/Alert.tsx
|
|
6144
|
-
import { useState as
|
|
6152
|
+
import { useState as useState13 } from "react";
|
|
6145
6153
|
import { Info as Info2, AlertTriangle as AlertTriangle3, CheckCircle as CheckCircle3, XCircle, X as X8 } from "lucide-react";
|
|
6146
6154
|
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6147
6155
|
var variantConfig = {
|
|
@@ -6193,7 +6201,7 @@ var Alert = ({
|
|
|
6193
6201
|
closeAriaLabel,
|
|
6194
6202
|
overflowHidden = true
|
|
6195
6203
|
}) => {
|
|
6196
|
-
const [open, setOpen] =
|
|
6204
|
+
const [open, setOpen] = useState13(true);
|
|
6197
6205
|
const t = useSmartTranslations("Common");
|
|
6198
6206
|
if (!open) return null;
|
|
6199
6207
|
const handleClose = () => {
|
|
@@ -6239,7 +6247,7 @@ var Alert = ({
|
|
|
6239
6247
|
var Alert_default = Alert;
|
|
6240
6248
|
|
|
6241
6249
|
// src/components/GlobalLoading.tsx
|
|
6242
|
-
import React20, { useEffect as
|
|
6250
|
+
import React20, { useEffect as useEffect10, useState as useState14 } from "react";
|
|
6243
6251
|
import { Activity as Activity2 } from "lucide-react";
|
|
6244
6252
|
|
|
6245
6253
|
// src/utils/loading.ts
|
|
@@ -6286,8 +6294,8 @@ var loading = new LoadingManager();
|
|
|
6286
6294
|
// src/components/GlobalLoading.tsx
|
|
6287
6295
|
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6288
6296
|
var GlobalLoading = ({ className, backdrop = true, position = "fixed", size = "lg" }) => {
|
|
6289
|
-
const [state, setState] =
|
|
6290
|
-
|
|
6297
|
+
const [state, setState] = useState14(() => loading.getState());
|
|
6298
|
+
useEffect10(() => {
|
|
6291
6299
|
const unsubscribe = loading.subscribe(setState);
|
|
6292
6300
|
return unsubscribe;
|
|
6293
6301
|
}, []);
|
|
@@ -6694,7 +6702,7 @@ var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
|
6694
6702
|
};
|
|
6695
6703
|
|
|
6696
6704
|
// src/components/DropdownMenu.tsx
|
|
6697
|
-
import React23, { useState as
|
|
6705
|
+
import React23, { useState as useState17 } from "react";
|
|
6698
6706
|
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6699
6707
|
function useResettingIndex(resetToken) {
|
|
6700
6708
|
const [state, setState] = React23.useState({ resetToken, index: -1 });
|
|
@@ -6722,7 +6730,7 @@ var DropdownMenu = ({
|
|
|
6722
6730
|
onOpenChange,
|
|
6723
6731
|
items
|
|
6724
6732
|
}) => {
|
|
6725
|
-
const [internalOpen, setInternalOpen] =
|
|
6733
|
+
const [internalOpen, setInternalOpen] = useState17(false);
|
|
6726
6734
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
6727
6735
|
const setOpen = onOpenChange || setInternalOpen;
|
|
6728
6736
|
const triggerRef = React23.useRef(null);
|
|
@@ -16661,7 +16669,7 @@ function OverlayControls({
|
|
|
16661
16669
|
}
|
|
16662
16670
|
|
|
16663
16671
|
// src/components/CategoryTreeSelect.tsx
|
|
16664
|
-
import { useEffect as
|
|
16672
|
+
import { useEffect as useEffect25, useId as useId9, useMemo as useMemo19, useRef as useRef19, useState as useState31 } from "react";
|
|
16665
16673
|
import { ChevronRight as ChevronRight6, ChevronDown as ChevronDown5, FolderTree, Layers, Search as Search6, SearchX as SearchX3, X as X14 } from "lucide-react";
|
|
16666
16674
|
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
16667
16675
|
var defaultLabels = {
|
|
@@ -16706,10 +16714,10 @@ function CategoryTreeSelect(props) {
|
|
|
16706
16714
|
leafOnlySelect = false,
|
|
16707
16715
|
singleSelect = false
|
|
16708
16716
|
} = props;
|
|
16709
|
-
const [isOpen, setIsOpen] =
|
|
16710
|
-
const [expandedNodes, setExpandedNodes] =
|
|
16711
|
-
const [query, setQuery] =
|
|
16712
|
-
const [localRequiredError, setLocalRequiredError] =
|
|
16717
|
+
const [isOpen, setIsOpen] = useState31(false);
|
|
16718
|
+
const [expandedNodes, setExpandedNodes] = useState31(() => getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline));
|
|
16719
|
+
const [query, setQuery] = useState31("");
|
|
16720
|
+
const [localRequiredError, setLocalRequiredError] = useState31();
|
|
16713
16721
|
const searchInputRef = useRef19(null);
|
|
16714
16722
|
const dropdownViewportRef = useRef19(null);
|
|
16715
16723
|
useOverlayScrollbarTarget(dropdownViewportRef, { enabled: useOverlayScrollbar });
|
|
@@ -16783,13 +16791,13 @@ function CategoryTreeSelect(props) {
|
|
|
16783
16791
|
}
|
|
16784
16792
|
return visible;
|
|
16785
16793
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery]);
|
|
16786
|
-
|
|
16794
|
+
useEffect25(() => {
|
|
16787
16795
|
if (!isOpen) return;
|
|
16788
16796
|
if (!isSearchEnabled) return;
|
|
16789
16797
|
const t = setTimeout(() => searchInputRef.current?.focus(), 50);
|
|
16790
16798
|
return () => clearTimeout(t);
|
|
16791
16799
|
}, [isOpen, isSearchEnabled]);
|
|
16792
|
-
|
|
16800
|
+
useEffect25(() => {
|
|
16793
16801
|
if (disabled || !required || valueArray.length > 0) {
|
|
16794
16802
|
setLocalRequiredError(void 0);
|
|
16795
16803
|
}
|
|
@@ -17261,7 +17269,7 @@ function CategoryTreeSelect(props) {
|
|
|
17261
17269
|
}
|
|
17262
17270
|
|
|
17263
17271
|
// src/components/ImageUpload.tsx
|
|
17264
|
-
import { useState as
|
|
17272
|
+
import { useState as useState32, useRef as useRef20, useCallback as useCallback15 } from "react";
|
|
17265
17273
|
import { Upload, X as X15, Image as ImageIcon, Loader2 as Loader25, Check as Check7 } from "lucide-react";
|
|
17266
17274
|
import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
17267
17275
|
function ImageUpload({
|
|
@@ -17279,9 +17287,9 @@ function ImageUpload({
|
|
|
17279
17287
|
browseText,
|
|
17280
17288
|
supportedFormatsText
|
|
17281
17289
|
}) {
|
|
17282
|
-
const [isDragging, setIsDragging] =
|
|
17283
|
-
const [uploading, setUploading] =
|
|
17284
|
-
const [uploadedImages, setUploadedImages] =
|
|
17290
|
+
const [isDragging, setIsDragging] = useState32(false);
|
|
17291
|
+
const [uploading, setUploading] = useState32(false);
|
|
17292
|
+
const [uploadedImages, setUploadedImages] = useState32([]);
|
|
17285
17293
|
const fileInputRef = useRef20(null);
|
|
17286
17294
|
const { addToast } = useToast();
|
|
17287
17295
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
@@ -17500,7 +17508,7 @@ import {
|
|
|
17500
17508
|
Trash2,
|
|
17501
17509
|
Upload as Upload2
|
|
17502
17510
|
} from "lucide-react";
|
|
17503
|
-
import { useCallback as useCallback16, useMemo as useMemo20, useRef as useRef21, useState as
|
|
17511
|
+
import { useCallback as useCallback16, useMemo as useMemo20, useRef as useRef21, useState as useState33 } from "react";
|
|
17504
17512
|
import { Fragment as Fragment16, jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
17505
17513
|
var formatFileSize = (bytes) => {
|
|
17506
17514
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -17607,8 +17615,8 @@ function FileUpload({
|
|
|
17607
17615
|
allowPreview = true,
|
|
17608
17616
|
initialFiles = []
|
|
17609
17617
|
}) {
|
|
17610
|
-
const [isDragging, setIsDragging] =
|
|
17611
|
-
const [files, setFiles] =
|
|
17618
|
+
const [isDragging, setIsDragging] = useState33(false);
|
|
17619
|
+
const [files, setFiles] = useState33(initialFiles);
|
|
17612
17620
|
const fileInputRef = useRef21(null);
|
|
17613
17621
|
const { addToast } = useToast();
|
|
17614
17622
|
const t = useSmartTranslations("FileUpload");
|
|
@@ -20100,7 +20108,7 @@ function ColorPicker({
|
|
|
20100
20108
|
}
|
|
20101
20109
|
|
|
20102
20110
|
// src/components/MusicPlayer.tsx
|
|
20103
|
-
import { useState as
|
|
20111
|
+
import { useState as useState39, useRef as useRef23, useEffect as useEffect29 } from "react";
|
|
20104
20112
|
import { Play as Play2, Pause as Pause2, SkipForward, SkipBack, Volume2 as Volume22, VolumeX as VolumeX2, List as List2, X as X17 } from "lucide-react";
|
|
20105
20113
|
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
20106
20114
|
var DEFAULT_PLAYLIST = [
|
|
@@ -20222,21 +20230,21 @@ var MusicPlayer = ({
|
|
|
20222
20230
|
className = "",
|
|
20223
20231
|
overflowHidden = true
|
|
20224
20232
|
}) => {
|
|
20225
|
-
const [currentSongIndex, setCurrentSongIndex] =
|
|
20226
|
-
const [isPlaying, setIsPlaying] =
|
|
20227
|
-
const [currentTime, setCurrentTime] =
|
|
20228
|
-
const [duration, setDuration] =
|
|
20229
|
-
const [volume, setVolume] =
|
|
20230
|
-
const [isMuted, setIsMuted] =
|
|
20231
|
-
const [showPlaylist, setShowPlaylist] =
|
|
20233
|
+
const [currentSongIndex, setCurrentSongIndex] = useState39(0);
|
|
20234
|
+
const [isPlaying, setIsPlaying] = useState39(false);
|
|
20235
|
+
const [currentTime, setCurrentTime] = useState39(0);
|
|
20236
|
+
const [duration, setDuration] = useState39(0);
|
|
20237
|
+
const [volume, setVolume] = useState39(1);
|
|
20238
|
+
const [isMuted, setIsMuted] = useState39(false);
|
|
20239
|
+
const [showPlaylist, setShowPlaylist] = useState39(initialShowPlaylist);
|
|
20232
20240
|
const audioRef = useRef23(null);
|
|
20233
20241
|
const currentSong = playlist[currentSongIndex];
|
|
20234
|
-
|
|
20242
|
+
useEffect29(() => {
|
|
20235
20243
|
if (audioRef.current) {
|
|
20236
20244
|
audioRef.current.volume = volume;
|
|
20237
20245
|
}
|
|
20238
20246
|
}, [volume]);
|
|
20239
|
-
|
|
20247
|
+
useEffect29(() => {
|
|
20240
20248
|
if (autoPlay && audioRef.current) {
|
|
20241
20249
|
audioRef.current.play().catch(() => {
|
|
20242
20250
|
setIsPlaying(false);
|
|
@@ -20312,7 +20320,7 @@ var MusicPlayer = ({
|
|
|
20312
20320
|
setCurrentSongIndex(index);
|
|
20313
20321
|
setIsPlaying(true);
|
|
20314
20322
|
};
|
|
20315
|
-
|
|
20323
|
+
useEffect29(() => {
|
|
20316
20324
|
if (audioRef.current) {
|
|
20317
20325
|
if (currentSong.startTime !== void 0) {
|
|
20318
20326
|
audioRef.current.currentTime = currentSong.startTime;
|
|
@@ -20900,7 +20908,8 @@ function DataTableBodyRows({
|
|
|
20900
20908
|
getRowKey,
|
|
20901
20909
|
getStickyColumnStyle,
|
|
20902
20910
|
getStickyCellClass,
|
|
20903
|
-
t
|
|
20911
|
+
t,
|
|
20912
|
+
labels
|
|
20904
20913
|
}) {
|
|
20905
20914
|
return /* @__PURE__ */ jsx63(TableBody, { children: loading2 ? /* @__PURE__ */ jsx63(TableRow, { children: /* @__PURE__ */ jsx63(TableCell, { colSpan: leafColumns.length, className: "text-center py-8", children: /* @__PURE__ */ jsxs52("div", { className: "flex items-center justify-center gap-2 text-muted-foreground", children: [
|
|
20906
20915
|
/* @__PURE__ */ jsxs52("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
@@ -20918,7 +20927,7 @@ function DataTableBodyRows({
|
|
|
20918
20927
|
t("loading"),
|
|
20919
20928
|
"\u2026"
|
|
20920
20929
|
] })
|
|
20921
|
-
] }) }) }) : displayedData.length === 0 ? /* @__PURE__ */ jsx63(TableRow, { children: /* @__PURE__ */ jsx63(TableCell, { colSpan: leafColumns.length, className: "text-center py-6 text-muted-foreground", children: t("noData") }) }) : displayedData.map((row, idx) => {
|
|
20930
|
+
] }) }) }) : displayedData.length === 0 ? /* @__PURE__ */ jsx63(TableRow, { children: /* @__PURE__ */ jsx63(TableCell, { colSpan: leafColumns.length, className: "text-center py-6 text-muted-foreground", children: labels?.noData || t("noData") }) }) : displayedData.map((row, idx) => {
|
|
20922
20931
|
const isStripedRow = striped && idx % 2 === 0;
|
|
20923
20932
|
return /* @__PURE__ */ jsx63(
|
|
20924
20933
|
TableRow,
|
|
@@ -22185,7 +22194,8 @@ function DataTable({
|
|
|
22185
22194
|
getRowKey,
|
|
22186
22195
|
getStickyColumnStyle,
|
|
22187
22196
|
getStickyCellClass,
|
|
22188
|
-
t
|
|
22197
|
+
t,
|
|
22198
|
+
labels
|
|
22189
22199
|
}
|
|
22190
22200
|
)
|
|
22191
22201
|
]
|
|
@@ -22434,7 +22444,7 @@ function AccessDenied({
|
|
|
22434
22444
|
|
|
22435
22445
|
// src/components/ThemeToggleHeadless.tsx
|
|
22436
22446
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
22437
|
-
import { useRef as useRef24, useState as
|
|
22447
|
+
import { useRef as useRef24, useState as useState40 } from "react";
|
|
22438
22448
|
import { createPortal as createPortal6 } from "react-dom";
|
|
22439
22449
|
import { Fragment as Fragment23, jsx as jsx71, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
22440
22450
|
function ThemeToggleHeadless({
|
|
@@ -22443,10 +22453,10 @@ function ThemeToggleHeadless({
|
|
|
22443
22453
|
labels,
|
|
22444
22454
|
className
|
|
22445
22455
|
}) {
|
|
22446
|
-
const [isOpen, setIsOpen] =
|
|
22456
|
+
const [isOpen, setIsOpen] = useState40(false);
|
|
22447
22457
|
const isHydrated = useHydrated();
|
|
22448
22458
|
const triggerRef = useRef24(null);
|
|
22449
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
22459
|
+
const [dropdownPosition, setDropdownPosition] = useState40(null);
|
|
22450
22460
|
const themes = [
|
|
22451
22461
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
22452
22462
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: Moon2 },
|
|
@@ -22535,7 +22545,7 @@ function ThemeToggleHeadless({
|
|
|
22535
22545
|
}
|
|
22536
22546
|
|
|
22537
22547
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
22538
|
-
import { useRef as useRef25, useState as
|
|
22548
|
+
import { useRef as useRef25, useState as useState41 } from "react";
|
|
22539
22549
|
import { createPortal as createPortal7 } from "react-dom";
|
|
22540
22550
|
import { Globe } from "lucide-react";
|
|
22541
22551
|
import { Fragment as Fragment24, jsx as jsx72, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
@@ -22546,8 +22556,8 @@ function LanguageSwitcherHeadless({
|
|
|
22546
22556
|
labels,
|
|
22547
22557
|
className
|
|
22548
22558
|
}) {
|
|
22549
|
-
const [isOpen, setIsOpen] =
|
|
22550
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
22559
|
+
const [isOpen, setIsOpen] = useState41(false);
|
|
22560
|
+
const [dropdownPosition, setDropdownPosition] = useState41(null);
|
|
22551
22561
|
const triggerButtonRef = useRef25(null);
|
|
22552
22562
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
22553
22563
|
const calculatePosition = () => {
|
|
@@ -22692,7 +22702,7 @@ function useLocale2() {
|
|
|
22692
22702
|
}
|
|
22693
22703
|
|
|
22694
22704
|
// src/components/UEditor/UEditor.tsx
|
|
22695
|
-
import React74, { useEffect as
|
|
22705
|
+
import React74, { useEffect as useEffect35, useImperativeHandle as useImperativeHandle3, useMemo as useMemo24, useRef as useRef31 } from "react";
|
|
22696
22706
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
22697
22707
|
|
|
22698
22708
|
// src/components/UEditor/extensions.ts
|
|
@@ -22731,7 +22741,7 @@ import { common, createLowlight } from "lowlight";
|
|
|
22731
22741
|
import { Extension } from "@tiptap/core";
|
|
22732
22742
|
import Suggestion from "@tiptap/suggestion";
|
|
22733
22743
|
import { ReactRenderer } from "@tiptap/react";
|
|
22734
|
-
import React66, { forwardRef as forwardRef13, useEffect as
|
|
22744
|
+
import React66, { forwardRef as forwardRef13, useEffect as useEffect31, useImperativeHandle, useRef as useRef26 } from "react";
|
|
22735
22745
|
import {
|
|
22736
22746
|
FileCode as FileCode2,
|
|
22737
22747
|
Heading1,
|
|
@@ -22938,7 +22948,7 @@ function buildSlashCommandItems({
|
|
|
22938
22948
|
var SlashCommandList = forwardRef13((props, ref) => {
|
|
22939
22949
|
const [selectedIndex, setSelectedIndex] = useResettingIndex2(props.items);
|
|
22940
22950
|
const listRef = useRef26(null);
|
|
22941
|
-
|
|
22951
|
+
useEffect31(() => {
|
|
22942
22952
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
22943
22953
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
22944
22954
|
}, [selectedIndex, props.items]);
|
|
@@ -23396,7 +23406,7 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
23396
23406
|
});
|
|
23397
23407
|
|
|
23398
23408
|
// src/components/UEditor/resizable-image.tsx
|
|
23399
|
-
import { useEffect as
|
|
23409
|
+
import { useEffect as useEffect32, useRef as useRef27, useState as useState42 } from "react";
|
|
23400
23410
|
import Image3 from "@tiptap/extension-image";
|
|
23401
23411
|
import { mergeAttributes } from "@tiptap/core";
|
|
23402
23412
|
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
@@ -23447,15 +23457,15 @@ function ResizableImageNodeView(props) {
|
|
|
23447
23457
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
23448
23458
|
const wrapperRef = useRef27(null);
|
|
23449
23459
|
const imgRef = useRef27(null);
|
|
23450
|
-
const [isHovered, setIsHovered] =
|
|
23451
|
-
const [isResizing, setIsResizing] =
|
|
23460
|
+
const [isHovered, setIsHovered] = useState42(false);
|
|
23461
|
+
const [isResizing, setIsResizing] = useState42(false);
|
|
23452
23462
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
23453
23463
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
23454
23464
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
23455
23465
|
const imageLayout = parseImageLayout(node.attrs["imageLayout"]);
|
|
23456
23466
|
const preserveAspectByDefault = imageLayout === "left" || imageLayout === "right";
|
|
23457
23467
|
const dragStateRef = useRef27(null);
|
|
23458
|
-
|
|
23468
|
+
useEffect32(() => {
|
|
23459
23469
|
const img = imgRef.current;
|
|
23460
23470
|
if (!img) return;
|
|
23461
23471
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -24100,7 +24110,7 @@ function buildUEditorExtensions({
|
|
|
24100
24110
|
}
|
|
24101
24111
|
|
|
24102
24112
|
// src/components/UEditor/toolbar.tsx
|
|
24103
|
-
import React71, { useRef as useRef29, useState as
|
|
24113
|
+
import React71, { useRef as useRef29, useState as useState44 } from "react";
|
|
24104
24114
|
import {
|
|
24105
24115
|
AlignCenter,
|
|
24106
24116
|
AlignJustify,
|
|
@@ -24292,7 +24302,7 @@ function deleteSelectedImage(editor) {
|
|
|
24292
24302
|
}
|
|
24293
24303
|
|
|
24294
24304
|
// src/components/UEditor/inputs.tsx
|
|
24295
|
-
import { useEffect as
|
|
24305
|
+
import { useEffect as useEffect33, useRef as useRef28, useState as useState43 } from "react";
|
|
24296
24306
|
import { Check as Check10, X as X19 } from "lucide-react";
|
|
24297
24307
|
import { jsx as jsx78, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
24298
24308
|
function normalizeUrl(raw) {
|
|
@@ -24308,9 +24318,9 @@ var LinkInput = ({
|
|
|
24308
24318
|
initialUrl = ""
|
|
24309
24319
|
}) => {
|
|
24310
24320
|
const t = useSmartTranslations("UEditor");
|
|
24311
|
-
const [url, setUrl] =
|
|
24321
|
+
const [url, setUrl] = useState43(initialUrl);
|
|
24312
24322
|
const inputRef = useRef28(null);
|
|
24313
|
-
|
|
24323
|
+
useEffect33(() => {
|
|
24314
24324
|
inputRef.current?.focus();
|
|
24315
24325
|
inputRef.current?.select();
|
|
24316
24326
|
}, []);
|
|
@@ -24337,10 +24347,10 @@ var LinkInput = ({
|
|
|
24337
24347
|
};
|
|
24338
24348
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
24339
24349
|
const t = useSmartTranslations("UEditor");
|
|
24340
|
-
const [url, setUrl] =
|
|
24341
|
-
const [alt, setAlt] =
|
|
24350
|
+
const [url, setUrl] = useState43("");
|
|
24351
|
+
const [alt, setAlt] = useState43("");
|
|
24342
24352
|
const inputRef = useRef28(null);
|
|
24343
|
-
|
|
24353
|
+
useEffect33(() => {
|
|
24344
24354
|
inputRef.current?.focus();
|
|
24345
24355
|
}, []);
|
|
24346
24356
|
const handleSubmit = (e) => {
|
|
@@ -24539,13 +24549,13 @@ var EditorToolbar = ({
|
|
|
24539
24549
|
}) => {
|
|
24540
24550
|
const t = useSmartTranslations("UEditor");
|
|
24541
24551
|
const { textColors, highlightColors } = useEditorColors();
|
|
24542
|
-
const [showImageInput, setShowImageInput] =
|
|
24543
|
-
const [isTableMenuOpen, setIsTableMenuOpen] =
|
|
24552
|
+
const [showImageInput, setShowImageInput] = useState44(false);
|
|
24553
|
+
const [isTableMenuOpen, setIsTableMenuOpen] = useState44(false);
|
|
24544
24554
|
const tableCommandAnchorPosRef = useRef29(null);
|
|
24545
24555
|
const fileInputRef = useRef29(null);
|
|
24546
|
-
const [isUploadingImage, setIsUploadingImage] =
|
|
24547
|
-
const [imageUploadError, setImageUploadError] =
|
|
24548
|
-
const [fontSizeDraft, setFontSizeDraft] =
|
|
24556
|
+
const [isUploadingImage, setIsUploadingImage] = useState44(false);
|
|
24557
|
+
const [imageUploadError, setImageUploadError] = useState44(null);
|
|
24558
|
+
const [fontSizeDraft, setFontSizeDraft] = useState44("");
|
|
24549
24559
|
const isImageSelected = editor.isActive("image");
|
|
24550
24560
|
const imageAttrs = editor.getAttributes("image");
|
|
24551
24561
|
const tableAttrs = editor.getAttributes("table");
|
|
@@ -25357,7 +25367,7 @@ var EditorToolbar = ({
|
|
|
25357
25367
|
};
|
|
25358
25368
|
|
|
25359
25369
|
// src/components/UEditor/menus.tsx
|
|
25360
|
-
import { useCallback as useCallback19, useEffect as
|
|
25370
|
+
import { useCallback as useCallback19, useEffect as useEffect34, useMemo as useMemo23, useRef as useRef30, useState as useState45 } from "react";
|
|
25361
25371
|
import { createPortal as createPortal8 } from "react-dom";
|
|
25362
25372
|
import {
|
|
25363
25373
|
AlignCenter as AlignCenter2,
|
|
@@ -25382,7 +25392,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
25382
25392
|
const messages = useMemo23(() => buildSlashCommandMessages(t), [t]);
|
|
25383
25393
|
const items = useMemo23(() => buildSlashCommandItems({ query: "", messages }), [messages]);
|
|
25384
25394
|
const listRef = useRef30(null);
|
|
25385
|
-
|
|
25395
|
+
useEffect34(() => {
|
|
25386
25396
|
const handleKeyDown2 = (event) => {
|
|
25387
25397
|
if (event.key === "Escape") {
|
|
25388
25398
|
event.preventDefault();
|
|
@@ -25412,7 +25422,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
25412
25422
|
};
|
|
25413
25423
|
var FloatingMenuContent = ({ editor }) => {
|
|
25414
25424
|
const t = useSmartTranslations("UEditor");
|
|
25415
|
-
const [showCommands, setShowCommands] =
|
|
25425
|
+
const [showCommands, setShowCommands] = useState45(false);
|
|
25416
25426
|
if (showCommands) {
|
|
25417
25427
|
return /* @__PURE__ */ jsx81(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
25418
25428
|
}
|
|
@@ -25437,8 +25447,8 @@ var BubbleMenuContent = ({
|
|
|
25437
25447
|
}) => {
|
|
25438
25448
|
const t = useSmartTranslations("UEditor");
|
|
25439
25449
|
const { textColors, highlightColors } = useEditorColors();
|
|
25440
|
-
const [showLinkInput, setShowLinkInput] =
|
|
25441
|
-
const [showEditorColorPalette, setShowEditorColorPalette] =
|
|
25450
|
+
const [showLinkInput, setShowLinkInput] = useState45(false);
|
|
25451
|
+
const [showEditorColorPalette, setShowEditorColorPalette] = useState45(false);
|
|
25442
25452
|
const isImageSelected = editor.isActive("image");
|
|
25443
25453
|
const imageAttrs = editor.getAttributes("image");
|
|
25444
25454
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
@@ -25454,10 +25464,10 @@ var BubbleMenuContent = ({
|
|
|
25454
25464
|
() => (lineHeights ?? getDefaultLineHeights()).filter((option) => ["1.2", "1.5", "1.75"].includes(option.value)),
|
|
25455
25465
|
[lineHeights]
|
|
25456
25466
|
);
|
|
25457
|
-
|
|
25467
|
+
useEffect34(() => {
|
|
25458
25468
|
onKeepOpenChange?.(showLinkInput);
|
|
25459
25469
|
}, [onKeepOpenChange, showLinkInput]);
|
|
25460
|
-
|
|
25470
|
+
useEffect34(() => {
|
|
25461
25471
|
if (!showLinkInput) return;
|
|
25462
25472
|
const close2 = () => setShowLinkInput(false);
|
|
25463
25473
|
editor.on("selectionUpdate", close2);
|
|
@@ -25644,8 +25654,8 @@ var CustomBubbleMenu = ({
|
|
|
25644
25654
|
}) => {
|
|
25645
25655
|
const SHOW_DELAY_MS = 180;
|
|
25646
25656
|
const BUBBLE_MENU_OFFSET = 16;
|
|
25647
|
-
const [isVisible, setIsVisible] =
|
|
25648
|
-
const [position, setPosition] =
|
|
25657
|
+
const [isVisible, setIsVisible] = useState45(false);
|
|
25658
|
+
const [position, setPosition] = useState45({ top: 0, left: 0 });
|
|
25649
25659
|
const menuRef = useRef30(null);
|
|
25650
25660
|
const keepOpenRef = useRef30(false);
|
|
25651
25661
|
const showTimeoutRef = useRef30(null);
|
|
@@ -25653,7 +25663,7 @@ var CustomBubbleMenu = ({
|
|
|
25653
25663
|
keepOpenRef.current = next;
|
|
25654
25664
|
if (next) setIsVisible(true);
|
|
25655
25665
|
}, []);
|
|
25656
|
-
|
|
25666
|
+
useEffect34(() => {
|
|
25657
25667
|
const clearShowTimeout = () => {
|
|
25658
25668
|
if (showTimeoutRef.current) {
|
|
25659
25669
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -25729,9 +25739,9 @@ var CustomBubbleMenu = ({
|
|
|
25729
25739
|
};
|
|
25730
25740
|
var CustomFloatingMenu = ({ editor }) => {
|
|
25731
25741
|
const FLOATING_MENU_OFFSET = 16;
|
|
25732
|
-
const [isVisible, setIsVisible] =
|
|
25733
|
-
const [position, setPosition] =
|
|
25734
|
-
|
|
25742
|
+
const [isVisible, setIsVisible] = useState45(false);
|
|
25743
|
+
const [position, setPosition] = useState45({ top: 0, left: 0 });
|
|
25744
|
+
useEffect34(() => {
|
|
25735
25745
|
const updatePosition = () => {
|
|
25736
25746
|
const { state, view } = editor;
|
|
25737
25747
|
const { $from, empty } = state.selection;
|
|
@@ -31669,14 +31679,14 @@ var UEditor = React74.forwardRef(({
|
|
|
31669
31679
|
}),
|
|
31670
31680
|
[content, editor, uploadImageForSave]
|
|
31671
31681
|
);
|
|
31672
|
-
|
|
31682
|
+
useEffect35(() => {
|
|
31673
31683
|
if (editor && content !== editor.getHTML()) {
|
|
31674
31684
|
if (editor.isEmpty && content) {
|
|
31675
31685
|
editor.commands.setContent(content);
|
|
31676
31686
|
}
|
|
31677
31687
|
}
|
|
31678
31688
|
}, [content, editor]);
|
|
31679
|
-
|
|
31689
|
+
useEffect35(() => {
|
|
31680
31690
|
if (!editor) return void 0;
|
|
31681
31691
|
const proseMirror = editor.view.dom;
|
|
31682
31692
|
const surface = editorContentRef.current;
|