aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingView.tsx
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-08-02 04:42:36 +0800
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-08-02 04:42:36 +0800
commitaf592ffc89be5f7026f38ddec89956de9c001ed3 (patch)
tree6d2e9b3782ce86b551cb1e226732128b0642c04a /src/client/views/collections/CollectionStackingView.tsx
parentddd6806e5684608a95d3c00357db730bdbf203c9 (diff)
drag actions
inc. multiple documents (fixed for all stacking collections)
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index c56ac9f77..dc6354383 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -286,14 +286,26 @@ export class CollectionStackingView extends CollectionSubView(StackingDocument)
}
});
if (super.onInternalDrop(e, de)) {
- const newDoc = de.complete.docDragData.droppedDocuments[0];
+ const newDocs = de.complete.docDragData.droppedDocuments;
const docs = this.childDocList;
if (docs) {
- if (targInd === -1) targInd = docs.length;
- else targInd = docs.indexOf(this.filteredChildren[targInd]);
- const srcInd = docs.indexOf(newDoc);
- docs.splice(srcInd, 1);
- docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, newDoc);
+ newDocs.map((doc, i) => {
+ if (i === 0) {
+ if (targInd === -1) targInd = docs.length;
+ else targInd = docs.indexOf(this.filteredChildren[targInd]);
+ const srcInd = docs.indexOf(doc);
+ docs.splice(srcInd, 1);
+ docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, doc);
+ } else {
+ if (targInd === -1) targInd = docs.length;
+ else targInd = docs.indexOf(this.filteredChildren[targInd]);
+ const srcInd = docs.indexOf(doc);
+ const firstInd = docs.indexOf(newDocs[0]);
+ docs.splice(srcInd, 1);
+ // docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, doc);
+ docs.splice(firstInd + 1, 0, doc);
+ }
+ });
}
}
}