This commit is contained in:
2025-11-07 23:48:25 +01:00
parent 8dd6be2a5d
commit 4bc7357e41
7 changed files with 77 additions and 38 deletions
+17 -4
View File
@@ -37,9 +37,9 @@ export const useDeskPointer = ({
onPromoteSelection,
onDocumentOpen,
selectedDocumentIds,
onClearSelection,
detailPanelOpen,
onCloseDetailPanel,
openOverlayForDoc = null,
}) => {
const pointerIntentRef = useRef(null);
const pointerStartRef = useRef({ x: 0, y: 0 });
@@ -401,9 +401,16 @@ export const useDeskPointer = ({
}
}
if (Array.isArray(selectedDocumentIds) && selectedDocumentIds.length > 0) {
if (
typeof openOverlayForDoc === 'function'
&& Array.isArray(selectedDocumentIds)
&& selectedDocumentIds.length > 0
) {
event.preventDefault();
onClearSelection?.();
const targetId = selectedDocumentIds[selectedDocumentIds.length - 1];
if (targetId) {
openOverlayForDoc(targetId);
}
return;
}
@@ -412,12 +419,18 @@ export const useDeskPointer = ({
safeInvoke(onCloseDetailPanel);
}
},
[detailPanelOpen, onClearSelection, onCloseDetailPanel, selectedDocumentIds],
[detailPanelOpen, onCloseDetailPanel, openOverlayForDoc, selectedDocumentIds],
);
return {
getCardPointerHandlers,
handleShellKeyDown,
focusShell: () => {
const shell = containerRef.current;
if (shell && typeof shell.focus === 'function') {
shell.focus({ preventScroll: true });
}
},
};
};