From c8be94244bcd094efba739e5a46034bceccea80f Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 24 Jan 2024 16:13:27 -0500
Subject: several fixes to drag/drop so that dropAction's set on target work
 for tree views, notetaking, formattedText, etc.   make bringToFront an
 optional prop.

---
 src/client/views/collections/CollectionTreeView.tsx | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

(limited to 'src/client/views/collections/CollectionTreeView.tsx')

diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 4696d7948..cc2cf87aa 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -140,15 +140,11 @@ export class CollectionTreeView extends CollectionSubView<Partial<collectionTree
         if ((this._mainEle = ele)) this._treedropDisposer = DragManager.MakeDropTarget(ele, this.onInternalDrop.bind(this), this.Document, this.onInternalPreDrop.bind(this));
     };
 
-    protected onInternalPreDrop = (e: Event, de: DragManager.DropEvent) => {
-        const dropAction = this.layoutDoc.dropAction as dropActionType;
+    protected onInternalPreDrop = (e: Event, de: DragManager.DropEvent, dropAction: dropActionType) => {
         const dragData = de.complete.docDragData;
         if (dragData) {
             const sameTree = Doc.AreProtosEqual(dragData.treeViewDoc, this.Document) ? true : false;
             const isAlreadyInTree = () => sameTree || dragData.draggedDocuments.some(d => d.embedContainer === this.Document && this.childDocs.includes(d));
-            if (isAlreadyInTree() !== sameTree) {
-                console.log('WHAAAT');
-            }
             dragData.dropAction = dropAction && !isAlreadyInTree() ? dropAction : sameTree && dragData.dropAction !== 'inSame' ? 'same' : dragData.dropAction;
             e.stopPropagation();
         }
@@ -254,7 +250,6 @@ export class CollectionTreeView extends CollectionSubView<Partial<collectionTree
                 moveDocument={returnFalse}
                 removeDocument={returnFalse}
                 whenChildContentsActiveChanged={this.whenChildContentsActiveChanged}
-                bringToFront={returnFalse}
             />
         );
     }
@@ -349,7 +344,6 @@ export class CollectionTreeView extends CollectionSubView<Partial<collectionTree
                     styleProvider={this._props.styleProvider}
                     containerViewPath={returnEmptyDoclist}
                     whenChildContentsActiveChanged={emptyFunction}
-                    bringToFront={emptyFunction}
                     childFilters={this._props.childFilters}
                     childFiltersByRanges={this._props.childFiltersByRanges}
                     searchFilterDocs={this._props.searchFilterDocs}
@@ -453,14 +447,13 @@ export class CollectionTreeView extends CollectionSubView<Partial<collectionTree
                         pointerEvents={this._props.isContentActive() && SnappingManager.IsDragging ? returnAll : returnNone}
                         isAnnotationOverlay={true}
                         isAnnotationOverlayScrollable={true}
-                        childDocumentsActive={this._props.isDocumentActive}
+                        childDocumentsActive={this._props.isContentActive}
                         fieldKey={this._props.fieldKey + '_annotations'}
                         dropAction="move"
                         select={emptyFunction}
                         addDocument={this.addAnnotationDocument}
                         removeDocument={this.remAnnotationDocument}
                         moveDocument={this.moveAnnotationDocument}
-                        bringToFront={emptyFunction}
                         renderDepth={this._props.renderDepth + 1}>
                         {this.content}
                     </CollectionFreeFormView>
-- 
cgit v1.2.3-70-g09d2

