This commit is contained in:
2025-11-07 12:44:44 +01:00
parent ae1884045d
commit 06ac9fc87e
4 changed files with 12 additions and 4 deletions
+12
View File
@@ -8,6 +8,14 @@ const DRAG_HYSTERESIS_PX = 4;
const DRAG_HYSTERESIS_SQUARED = DRAG_HYSTERESIS_PX * DRAG_HYSTERESIS_PX;
const EDGE_COLLISION_THRESHOLD = 0.5;
const getEventTargetElement = (event) => {
if (typeof Element === 'undefined' || !event) {
return null;
}
const candidate = event.target || (event.nativeEvent ? event.nativeEvent.target : null);
return candidate instanceof Element ? candidate : null;
};
const useDocumentDrag = (options = {}) => {
const {
engine,
@@ -139,6 +147,10 @@ const useDocumentDrag = (options = {}) => {
const handlePointerDown = useCallback(
(event, docIdInput, options = {}) => {
const targetElement = getEventTargetElement(event);
if (targetElement && typeof targetElement.closest === 'function' && targetElement.closest('[data-desk-tag-chip="true"]')) {
return;
}
preventAll(event);
const docId = docIdInput != null ? docIdInput : null;