This commit is contained in:
2025-11-02 15:03:23 +01:00
parent 8f86a71c39
commit d6a6d1233c
10 changed files with 630 additions and 19 deletions
+28 -9
View File
@@ -97,18 +97,21 @@ const useDocumentDrag = () => {
if (event && (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) {
return;
}
openOverlayForDoc(data.docId, data.originInfo);
},
onDouble: ({ data }) => {
if (!data || !data.docId) {
return;
}
if (typeof onInspectDocument === 'function') {
onInspectDocument(data.docId);
return;
}
onDocumentOpen?.(data.docId);
},
onDouble: ({ data, event }) => {
if (!data || !data.docId) {
return;
}
if (event && (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) {
return;
}
openOverlayForDoc(data.docId, data.originInfo);
},
});
const dragStateRef = useRef(null);
@@ -247,7 +250,7 @@ const useDocumentDrag = () => {
);
const handlePointerDown = useCallback(
(event, docIdInput) => {
(event, docIdInput, options = {}) => {
if (debugDrag) {
console.log(
'[desk] handlePointerDown fired for doc',
@@ -275,15 +278,31 @@ const useDocumentDrag = () => {
return;
}
const stackDocIdsOption = Array.isArray(options?.stackDocIds)
? options.stackDocIds
.map((value) => (value != null ? String(value) : null))
.filter(Boolean)
: null;
let selectionIds = Array.isArray(selectedDocumentIds)
? selectedDocumentIds.map((id) => String(id))
: [];
if (stackDocIdsOption && stackDocIdsOption.length) {
selectionIds = stackDocIdsOption;
}
const metaOrCtrl = event.metaKey || event.ctrlKey;
if (metaOrCtrl && !selectionIds.includes(docKey)) {
if (!stackDocIdsOption && metaOrCtrl && !selectionIds.includes(docKey)) {
selectionIds = [...selectionIds, docKey];
}
let groupDocIds = [];
if (selectionIds.includes(docKey) && selectionIds.length > 1) {
if (stackDocIdsOption && stackDocIdsOption.length) {
groupDocIds = stackDocIdsOption.filter((id, index, array) => {
const unique = array.indexOf(id) === index;
return unique && documentLookup.has(id);
});
} else if (selectionIds.includes(docKey) && selectionIds.length > 1) {
groupDocIds = selectionIds
.map((id) => String(id))
.filter((id, index, array) => array.indexOf(id) === index && documentLookup.has(id));