diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/views/collections/CollectionNoteTakingView.tsx | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index e80266b22..95aafce94 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -53,11 +53,8 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti return this.props.chromeHidden || BoolCast(this.layoutDoc.chromeHidden); } @computed get columnHeaders() { - const columnHeaders = Cast(this.dataDoc.columnHeaders, listSpec(SchemaHeaderField), null); - let docs = this.childDocs; - const needsUnsetCategory = docs.some(d => { - return !d[this.notetakingCategoryField] && !columnHeaders.find(sh => sh.heading === 'unset'); - }); + const columnHeaders = Array.from(Cast(this.dataDoc.columnHeaders, listSpec(SchemaHeaderField), null)); + const needsUnsetCategory = this.childDocs.some(d => !d[this.notetakingCategoryField] && !columnHeaders.find(sh => sh.heading === 'unset')); // @#Oberable draggedColIndex = ... //@observable cloneDivXYcoords @@ -510,21 +507,28 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti } // when dropping outside of the current noteTaking context (like a new tab, freeform view, etc...) - @undoBatch - @action onExternalDrop = async (e: React.DragEvent): Promise<void> => { const targInd = this.docsDraggedRowCol?.[0] || 0; - super.onExternalDrop(e, {}, docus => { - this.onPointerMove(true, e.clientX, e.clientY); - docus?.map(doc => this.addDocument(doc)); - const newDoc = this.childDocs.lastElement(); - const docs = this.childDocList; - if (docs && targInd !== -1) { - docs.splice(docs.length - 1, 1); - docs.splice(targInd, 0, newDoc); - } - this.removeDocDragHighlight(); - }); + const colInd = this.docsDraggedRowCol?.[1] || 0; + super.onExternalDrop( + e, + {}, + undoBatch( + action(docus => { + this.onPointerMove(true, e.clientX, e.clientY); + docus?.map((doc: Doc) => this.addDocument(doc)); + const newDoc = this.childDocs.lastElement(); + const colHeader = StrCast(this.columnHeaders[colInd].heading); + newDoc[this.notetakingCategoryField] = colHeader; + const docs = this.childDocList; + if (docs && targInd !== -1) { + docs.splice(docs.length - 1, 1); + docs.splice(targInd, 0, newDoc); + } + this.removeDocDragHighlight(); + }) + ) + ); }; headings = () => Array.from(this.Sections); |
