From 00f466d3b79eebcb9be42a5d88c8dc083a7be376 Mon Sep 17 00:00:00 2001
From: Abdullah Ahmed <abdullah_ahmed@brown.edu>
Date: Thu, 18 Jul 2019 15:58:12 -0400
Subject: more improvements

---
 src/client/util/TooltipTextMenu.tsx | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'src/client/util/TooltipTextMenu.tsx')

diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 0c2645a5c..0c81eda2b 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -109,8 +109,10 @@ export class TooltipTextMenu {
                 if (dom.contains(e.target as Node)) {
                     e.stopPropagation();
                     command(view.state, view.dispatch, view);
-                    if (dom.style.color === "white") { dom.style.color = "greenyellow"; }
-                    else { dom.style.color = "white"; }
+                    if (this.view.state.selection.empty) {
+                        if (dom.style.color === "white") { dom.style.color = "greenyellow"; }
+                        else { dom.style.color = "white"; }
+                    }
                 }
             });
 
@@ -760,7 +762,7 @@ export class TooltipTextMenu {
     //finds all active marks on selection in given group
     activeMarksOnSelection(markGroup: MarkType[]) {
         //current selection
-        let { empty, ranges } = this.view.state.selection as TextSelection;
+        let { empty, ranges, $to } = this.view.state.selection as TextSelection;
         let state = this.view.state;
         let dispatch = this.view.dispatch;
         let activeMarks: MarkType[];
@@ -775,6 +777,9 @@ export class TooltipTextMenu {
                 }
                 return false;
             });
+
+            const refnode = this.reference_node($to);
+            this._activeMarks = refnode.marks;
         }
         else {
             const pos = this.view.state.selection.$from;
-- 
cgit v1.2.3-70-g09d2

