From d20c02b245148524f3d6f4fd4dc2dff7a3039b06 Mon Sep 17 00:00:00 2001
From: Lauren Choi <laurenchoi@gmail.com>
Date: Sat, 30 Oct 2021 15:30:31 -0400
Subject: change follow behavior

---
 src/client/views/PropertiesView.tsx | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

(limited to 'src/client/views/PropertiesView.tsx')

diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 69224312a..13018b268 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -1087,8 +1087,6 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
 
     @observable
     description = Field.toString(LinkManager.currentLink?.description as any as Field);
-    @observable
-    follow = Field.toString(LinkManager.currentLink?.follow as any as Field);
 
     @action
     handleDescriptionChange = (e: React.ChangeEvent<HTMLInputElement>) => { this.description = e.target.value; }
@@ -1109,6 +1107,12 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
         }
     });
 
+    getCurrentFollow = () => {
+        if (LinkManager.currentLink) {
+            return StrCast(Doc.GetProto(LinkManager.currentLink).followLinkLocation);
+        }
+    }
+
     onSelectOut = () => {
         this.setDescripValue(this.description);
         document.getElementById('input')?.blur();
@@ -1180,15 +1184,13 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
                         <p className="propertiesView-label">Behavior</p>
                         <div className="propertiesView-input inline first" id="propertiesView-follow">
                             <p>Follow</p>
-                            <select name="selectList" id="selectList">
-                                <option value="default" onPointerDown={() => {
-                                    this.changeFollowBehavior("default")
-                                    console.log("default")
-                                }}>Default</option>
-                                <option value="newLeft" onPointerDown={() => {
-                                    this.changeFollowBehavior("newLeft")
-                                    console.log("newLeft")
-                                }}>Open in new left pane</option>
+                            <select
+                                name="selectList"
+                                id="selectList"
+                                onChange={e => this.changeFollowBehavior(e.currentTarget.value)}
+                                value={this.getCurrentFollow()}>
+                                <option value="default">Default</option>
+                                <option value="newLeft">Open in new left pane</option>
                                 <option value="newRight">Open in new right pane</option>
                                 <option value="replaceLeft">Replace left tab</option>
                                 <option value="replaceRight">Replace right tab</option>
-- 
cgit v1.2.3-70-g09d2

