diff options
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingView.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
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<Partial<collecti const droppedDocs = this.childDocs.slice().filter((d: Doc, ind: number) => 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) } } } |