From 3dd0a92767972736f415341c0b6e06e6e3a242b1 Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Mon, 1 Jul 2024 16:38:24 -0400
Subject: highlighting then un-highlighting a selected cell with equations now
 properly maintains original select highlight

---
 .../collectionSchema/CollectionSchemaView.tsx         | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

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

diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 7a90b3505..b81cfa821 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -606,12 +606,24 @@ export class CollectionSchemaView extends CollectionSubView() {
         return cells;
     }
 
+    selectionOverlap = (doc: Doc): [boolean, boolean] => {
+        const docs = this.docsWithDrag.docs;
+        const index = this.rowIndex(doc);
+        const selectedBelow: boolean = this._selectedDocs.includes(docs[index + 1]);
+        const selectedAbove: boolean = this._selectedDocs.includes(docs[index - 1]);
+        return [selectedAbove, selectedBelow];
+    }
+
     removeCellHighlights = () => {
         this._highlightedCellsInfo.forEach(info => {
             const doc = info[0];
             const field = info[1];
             const cell = this.getCellElement(doc, field);
-            if (!(this._selectedDocs.includes(doc) && this._selectedCol === this.columnKeys.indexOf(field))) cell.style.border = ''; 
+            if (this._selectedDocs.includes(doc) && this._selectedCol === this.columnKeys.indexOf(field)) {
+                cell.style.border = `solid 2px ${Colors.MEDIUM_BLUE}`;
+                if (this.selectionOverlap(doc)[0]) cell.style.borderTop = '';
+                if (this.selectionOverlap(doc)[1]) cell.style.borderBottom = '';
+            } else cell.style.border = '';
             cell.style.backgroundColor = '';});
         this._highlightedCellsInfo = [];
     }
@@ -741,7 +753,6 @@ export class CollectionSchemaView extends CollectionSubView() {
 
     @action
     onInternalDrop = (e: Event, de: DragManager.DropEvent) => {
-        console.log('called')
         if (de.complete.columnDragData) {
             setTimeout(() => {this.setColDrag(false);});
             e.stopPropagation();
@@ -881,8 +892,8 @@ export class CollectionSchemaView extends CollectionSubView() {
         this.closeColumnMenu();
     };
 
-    setColumnValues = (key: string, value: string) => {
-        if (this._selectedCells.length === 1) this.docs.forEach(doc => !doc._lockedSchemaEditing &&Doc.SetField(doc, key, value)); 
+    setCellValues = (key: string, value: string) => {
+        if (this._selectedCells.length === 1) this.docs.forEach(doc => !doc._lockedSchemaEditing && Doc.SetField(doc, key, value)); 
         else this._selectedCells.forEach(doc => !doc._lockedSchemaEditing && Doc.SetField(doc, key, value)); 
         return true;
     };
-- 
cgit v1.2.3-70-g09d2

