various
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user