From bb02d3a052efdbf25d1069059a92b7a9d9cc1708 Mon Sep 17 00:00:00 2001 From: ljungster Date: Wed, 22 Jun 2022 14:37:44 -0500 Subject: did it! --- src/client/views/collections/CollectionNoteTakingView.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index dfee1b173..9519e9aaa 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -418,19 +418,21 @@ export class CollectionNoteTakingView extends CollectionSubView ind >= this.childDocs.length); // if the drop operation adds something to the end of the list, then use that as the new document (may be different than what was dropped e.g., in the case of a button which is dropped but which creates say, a note). const newDocs = droppedDocs.length ? droppedDocs : de.complete.docDragData.droppedDocuments; - const docs = this.childDocs + // const docs = this.childDocs + const docs = this.childDocList if (docs && newDocs.length) { // remove the dragged documents from the childDocList newDocs.filter(d => docs.indexOf(d) !== -1).forEach(d => docs.splice(docs.indexOf(d), 1)) // if the doc starts a columnm (or the drop index is undefined), we can just push it to the front. Otherwise we need to add it to the column properly //TODO: you need to update childDocList instead. It seems that childDocs is a copy of the actual array we want to modify if (rowCol[0] <= 0) { - docs.unshift(...newDocs) + docs.splice(0, 0, ...newDocs) } else { const colDocs = this.getDocsFromXCoord(de.x) const previousDoc = colDocs[rowCol[0] - 1] const previousDocIndex = docs.indexOf(previousDoc) - docs.splice(previousDocIndex, 0, ...newDocs) + console.log(`docs: ${previousDocIndex}`) + docs.splice(previousDocIndex + 1, 0, ...newDocs) } } } -- cgit v1.2.3-70-g09d2