This commit is contained in:
2025-11-04 00:48:37 +01:00
parent 01fd774b18
commit f523e5651b
3 changed files with 166 additions and 182 deletions
+10 -12
View File
@@ -158,24 +158,22 @@ const useDocumentDrag = () => {
: [];
if (stackDocIdsOption && stackDocIdsOption.length) {
selectionIds = stackDocIdsOption;
const selectionSet = new Set(selectionIds);
stackDocIdsOption.forEach((value) => {
if (value != null) {
selectionSet.add(String(value));
}
});
selectionIds = Array.from(selectionSet);
}
const metaOrCtrl = event.metaKey || event.ctrlKey;
if (!stackDocIdsOption && metaOrCtrl && !selectionIds.includes(docKey)) {
selectionIds = [...selectionIds, docKey];
}
let groupDocIds = [];
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));
}
let groupDocIds = selectionIds
.map((id) => String(id))
.filter((id, index, array) => array.indexOf(id) === index && documentLookup.has(id));
if (!groupDocIds.includes(docKey)) {
groupDocIds.unshift(docKey);
}