@yogiswara/honcho-editor-ui 2.10.7 → 2.10.8
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,10 +10,14 @@ export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
|
|
|
10
10
|
if (!isBatchMode) {
|
|
11
11
|
onDragStart();
|
|
12
12
|
}
|
|
13
|
+
document.addEventListener("mouseup", handleEnd);
|
|
14
|
+
document.addEventListener("touchend", handleEnd);
|
|
13
15
|
};
|
|
14
16
|
// A single handler for ending the drag
|
|
15
17
|
const handleEnd = () => {
|
|
16
18
|
onDragEnd();
|
|
19
|
+
document.removeEventListener("mouseup", handleEnd);
|
|
20
|
+
document.removeEventListener("touchend", handleEnd);
|
|
17
21
|
};
|
|
18
22
|
// Listen for BOTH mouse and touch start events
|
|
19
23
|
slider.addEventListener('mousedown', handleStart);
|
|
@@ -27,6 +31,8 @@ export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
|
|
|
27
31
|
slider.removeEventListener('touchstart', handleStart);
|
|
28
32
|
slider.removeEventListener('mouseup', handleEnd);
|
|
29
33
|
slider.removeEventListener('touchend', handleEnd);
|
|
34
|
+
document.removeEventListener("mouseup", handleEnd);
|
|
35
|
+
document.removeEventListener("touchend", handleEnd);
|
|
30
36
|
};
|
|
31
37
|
}, [onDragStart, onDragEnd, isBatchMode]);
|
|
32
38
|
return sliderRef;
|