@yogiswara/honcho-editor-ui 2.10.3 → 2.10.5
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.
|
@@ -10,7 +10,6 @@ interface Props {
|
|
|
10
10
|
activeSubPanel: string;
|
|
11
11
|
setActivePanel: (tab: string) => void;
|
|
12
12
|
setActiveSubPanel: (subTab: string) => void;
|
|
13
|
-
activeTab: string;
|
|
14
13
|
innerRef?: React.Ref<HTMLDivElement>;
|
|
15
14
|
panelRef: React.RefObject<HTMLDivElement>;
|
|
16
15
|
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
@@ -4,5 +4,5 @@ import HSliderLightMobile from "./HSliderLightMobile";
|
|
|
4
4
|
import HSliderDetailsMobile from "./HSliderDetailsMobile";
|
|
5
5
|
import { Box } from "@mui/material";
|
|
6
6
|
export default function HTabColorAdjustmentMobile(props) {
|
|
7
|
-
return (_jsxs(Box, { ref: props.innerRef, children: [props.
|
|
7
|
+
return (_jsxs(Box, { ref: props.innerRef, children: [props.activeSubPanel === "light" && _jsx(HSliderLightMobile, { ...props }), props.activeSubPanel === "color" && _jsx(HSliderColorMobile, { ...props }), props.activeSubPanel === "details" && _jsx(HSliderDetailsMobile, { ...props })] }));
|
|
8
8
|
}
|
|
@@ -9,19 +9,38 @@ export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
|
|
|
9
9
|
if (!isBatchMode) {
|
|
10
10
|
onDragStart();
|
|
11
11
|
}
|
|
12
|
+
// Add document listeners when dragging starts
|
|
13
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
14
|
+
document.addEventListener("touchend", handleTouchEnd);
|
|
15
|
+
};
|
|
16
|
+
const handleTouchStart = () => {
|
|
17
|
+
if (!isBatchMode) {
|
|
18
|
+
onDragStart();
|
|
19
|
+
}
|
|
20
|
+
// Add document listeners when dragging starts
|
|
21
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
22
|
+
document.addEventListener("touchend", handleTouchEnd);
|
|
12
23
|
};
|
|
13
24
|
const handleMouseUp = () => {
|
|
14
25
|
onDragEnd();
|
|
26
|
+
// Remove document listeners when dragging ends
|
|
27
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
28
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
29
|
+
};
|
|
30
|
+
const handleTouchEnd = () => {
|
|
31
|
+
onDragEnd();
|
|
32
|
+
// Remove document listeners when dragging ends
|
|
33
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
34
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
15
35
|
};
|
|
16
36
|
sliderElement.addEventListener("mousedown", handleMouseDown);
|
|
17
|
-
sliderElement.addEventListener("
|
|
18
|
-
sliderElement.addEventListener("touchstart", handleMouseDown);
|
|
19
|
-
sliderElement.addEventListener("touchend", handleMouseUp);
|
|
37
|
+
sliderElement.addEventListener("touchstart", handleTouchStart);
|
|
20
38
|
return () => {
|
|
21
39
|
sliderElement.removeEventListener("mousedown", handleMouseDown);
|
|
22
|
-
sliderElement.removeEventListener("
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
sliderElement.removeEventListener("touchstart", handleTouchStart);
|
|
41
|
+
// Clean up any remaining document listeners
|
|
42
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
43
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
25
44
|
};
|
|
26
45
|
}, [onDragStart, onDragEnd, isBatchMode]);
|
|
27
46
|
return sliderRef; // Return the ref to be attached to the slider
|