From ef24cc445aa466cae3b6c40029f7d7bc9baa81b7 Mon Sep 17 00:00:00 2001
From: ab <abdullah_ahmed@brown.edu>
Date: Fri, 7 Jun 2019 16:37:10 -0400
Subject: frustrated!

---
 src/client/util/TooltipTextMenu.tsx | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

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

diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx
index 1f1ad9cd4..366105ad9 100644
--- a/src/client/util/TooltipTextMenu.tsx
+++ b/src/client/util/TooltipTextMenu.tsx
@@ -234,7 +234,12 @@ export class TooltipTextMenu {
             this.tooltip.appendChild(this.linkEditor);
 
             let starButton = document.createElement("button");
-            starButton.textContent = "ST";
+            // starButton.style.width = '10px';
+            // starButton.style.height = '10px';
+            starButton.style.marginLeft = '10px';
+            starButton.textContent = "Summarize";
+            starButton.style.color = 'black';
+            starButton.style.backgroundColor = 'white';
             starButton.onclick = () => {
                 let state = this.view.state;
                 this.insertStar(state, this.view.dispatch);
@@ -266,16 +271,21 @@ export class TooltipTextMenu {
         link = node && node.marks.find(m => m.type.name === "link");
     }
 
-    insertStar(state: any, dispatch: any) {
+    insertStar(state: EditorState<any>, dispatch: any) {
         console.log("creating star...");
         let type = schema.nodes.star;
-        let { $from } = state.selection;
-        if (!$from.parent.canReplaceWith($from.index(), $from.index(), type)) {
-            return false;
-        }
+        //let {$from} = state.selection;
+        let select = state.selection;
         if (dispatch) {
-            dispatch(state.tr.replaceSelectionWith(type.create()));
+            dispatch(state.tr.setMeta('select.visible', false));
         }
+        // console.log($from);
+        // if (!$from.parent.canReplaceWith($from.index(), $from.index(), type)) {
+        //     return false;
+        // }
+        // if (dispatch) {
+        //     dispatch(state.tr.replaceSelectionWith(type.create()));
+        // }
         return true;
     }
 
-- 
cgit v1.2.3-70-g09d2

