mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
fix: deselect text before timeline selection
This commit is contained in:
@@ -190,6 +190,22 @@ export function useSelectionBox({
|
|||||||
};
|
};
|
||||||
}, [selectionBox, selectElementsInBox]);
|
}, [selectionBox, selectElementsInBox]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!selectionBox?.isActive) return;
|
||||||
|
|
||||||
|
const previousBodyUserSelect = document.body.style.userSelect;
|
||||||
|
const container = containerRef.current;
|
||||||
|
const previousContainerUserSelect = container?.style.userSelect ?? "";
|
||||||
|
|
||||||
|
document.body.style.userSelect = "none";
|
||||||
|
if (container) container.style.userSelect = "none";
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.body.style.userSelect = previousBodyUserSelect;
|
||||||
|
if (container) container.style.userSelect = previousContainerUserSelect;
|
||||||
|
};
|
||||||
|
}, [selectionBox?.isActive, containerRef]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
selectionBox,
|
selectionBox,
|
||||||
handleMouseDown,
|
handleMouseDown,
|
||||||
|
|||||||
Reference in New Issue
Block a user