feat(ui): integrate RichTextEditor for product full description and add click-outside handlers for dropdowns
This commit is contained in:
1 parent
1651a593bd
commit
bfb7f42065
18 files changed
+150012
-5970
No files matched your search
@@ -87,6 +87,22 @@ export default function RichTextEditor({
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
const [showColorPicker, setShowColorPicker] = useState(false);
|
||||
const [showBgColorPicker, setShowBgColorPicker] = useState(false);
|
||||
const colorPickerRef = useRef<HTMLDivElement>(null);
|
||||
const bgColorPickerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (colorPickerRef.current && !colorPickerRef.current.contains(event.target as Node)) {
|
||||
setShowColorPicker(false);
|
||||
}
|
||||
if (bgColorPickerRef.current && !bgColorPickerRef.current.contains(event.target as Node)) {
|
||||
setShowBgColorPicker(false);
|
||||
}
|
||||
};
|
||||
document.addEventListener('mousedown', handleClickOutside);
|
||||
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||
}, []);
|
||||
|
||||
const [customColor, setCustomColor] = useState('#111827');
|
||||
const [customBgColor, setCustomBgColor] = useState('#fef08a');
|
||||
|
||||
@@ -608,7 +624,7 @@ export default function RichTextEditor({
|
||||
</div>
|
||||
|
||||
{/* Text Color Picker */}
|
||||
<div className="relative">
|
||||
<div ref={colorPickerRef} className="relative">
|
||||
<button
|
||||
type="button"
|
||||
disabled={isCodeMode}
|
||||
@@ -674,7 +690,7 @@ export default function RichTextEditor({
|
||||
</div>
|
||||
|
||||
{/* Background Color Picker */}
|
||||
<div className="relative">
|
||||
<div ref={bgColorPickerRef} className="relative">
|
||||
<button
|
||||
type="button"
|
||||
disabled={isCodeMode}
|
||||
|
||||
Reference in new issue
Block a user