From 171852260c04ba7aafd789b231d98cdaa2a7dc8d Mon Sep 17 00:00:00 2001
From: laurawilsonri <laura_wilson@brown.edu>
Date: Mon, 25 Feb 2019 19:44:58 -0500
Subject: all but removing preview cursor works

---
 src/client/views/nodes/DocumentView.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 914182efa..bb6c8d13a 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -120,7 +120,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
         }
         if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) {
             //remove preview cursor from collection
-            if (this.props.ContainingCollectionView != undefined && this.props.ContainingCollectionView instanceof CollectionFreeFormView) {
+            if (this.props.ContainingCollectionView != undefined) {
                 this.props.ContainingCollectionView.hidePreviewCursor();
             }
             this._contextMenuCanOpen = false;
@@ -208,6 +208,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
             onError={(test: any) => { console.log(test) }}
         />
     }
+
     render() {
         if (!this.props.Document)
             return <div></div>
-- 
cgit v1.2.3-70-g09d2


From 11327191e249382cc5d2551f1fd262d3a4ff25b9 Mon Sep 17 00:00:00 2001
From: laurawilsonri <laura_wilson@brown.edu>
Date: Mon, 25 Feb 2019 20:58:11 -0500
Subject: ALL SETgit add -A

---
 src/client/util/SelectionManager.ts                     |  5 -----
 src/client/views/collections/CollectionFreeFormView.tsx | 10 +++++-----
 src/client/views/collections/CollectionView.tsx         | 17 -----------------
 src/client/views/nodes/DocumentView.tsx                 |  6 ++----
 4 files changed, 7 insertions(+), 31 deletions(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index d5d9b29b2..c349e7631 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -9,11 +9,6 @@ export namespace SelectionManager {
         @action
         SelectDoc(doc: DocumentView, ctrlPressed: boolean): void {
 
-            //remove preview cursor from collection
-            if (doc.props.ContainingCollectionView != undefined) {
-                doc.props.ContainingCollectionView.hidePreviewCursor();
-            }
-
             // if doc is not in SelectedDocuments, add it
             if (!ctrlPressed) {
                 manager.SelectedDocuments = [];
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index c2d2b0f7b..cd88c931b 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -90,7 +90,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
         if (Math.abs(this._downX - e.clientX) < 3 && Math.abs(this._downY - e.clientY) < 3) {
             //show preview text cursor on tap
             this._previewCursorVisible = true;
-            this.props.CollectionView.showPreviewCursor();
             //select is not already selected
             if (!this.props.isSelected()) {
                 this.props.select(false);
@@ -262,17 +261,17 @@ export class CollectionFreeFormView extends CollectionViewBase {
     getLocalTransform = (): Transform => Transform.Identity.translate(-this.panX, -this.panY).scale(1 / this.scale);
     noScaling = () => 1;
 
-    //hides the preview cursor for generating new text boxes - called when other docs are selected/dragged
+    //when focus is lost, this will remove the preview cursor
     @action
-    hidePreviewCursor() {
+    onBlur = (e: React.FocusEvent<HTMLInputElement>): void => {
         this._previewCursorVisible = false;
     }
 
     render() {
 
+        //determines whether preview text cursor should be visible (ie when user taps this collection it should)
         let cursor = null;
-        //toggle for preview cursor -> will be on when user taps freeform
-        if (this._previewCursorVisible && this.props.CollectionView.isFocusOn) {
+        if (this._previewCursorVisible) {
             //get local position and place cursor there!
             let [x, y] = this.getTransform().transformPoint(this._downX, this._downY);
             cursor = <div id="prevCursor" onKeyPress={this.onKeyDown} style={{ color: "black", position: "absolute", transformOrigin: "left top", transform: `translate(${x}px, ${y}px)` }}>I</div>
@@ -289,6 +288,7 @@ export class CollectionFreeFormView extends CollectionViewBase {
                 onContextMenu={(e) => e.preventDefault()}
                 onDrop={this.onDrop.bind(this)}
                 onDragOver={this.onDragOver}
+                onBlur={this.onBlur}
                 style={{ borderWidth: `${COLLECTION_BORDER_WIDTH}px`, }}
                 tabIndex={0}
                 ref={this.createDropTarget}>
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 6ab0f15c0..11cc6d28e 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -28,8 +28,6 @@ export const COLLECTION_BORDER_WIDTH = 2;
 @observer
 export class CollectionView extends React.Component<CollectionViewProps> {
 
-    private _focusOn: boolean = false;
-
     public static LayoutString(fieldKey: string = "DataKey") {
         return `<CollectionView Document={Document}
                     ScreenToLocalTransform={ScreenToLocalTransform} fieldKey={${fieldKey}} panelWidth={PanelWidth} panelHeight={PanelHeight} isSelected={isSelected} select={select} bindings={bindings}
@@ -73,21 +71,6 @@ export class CollectionView extends React.Component<CollectionViewProps> {
         return false
     }
 
-
-
-    @computed
-    get isFocusOn() { return this._focusOn; }
-
-    @action
-    showPreviewCursor() {
-        this._focusOn = true;
-    }
-
-    @action
-    hidePreviewCursor() {
-        this._focusOn = false;
-    }
-
     get collectionViewType(): CollectionViewType {
         let Document = this.props.Document;
         let viewField = Document.GetT(KeyStore.ViewType, NumberField);
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index a7632b008..6ff75c4dc 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -113,16 +113,14 @@ export class DocumentView extends React.Component<DocumentViewProps> {
         }
     }
 
+
     onPointerMove = (e: PointerEvent): void => {
         if (e.cancelBubble) {
             this._contextMenuCanOpen = false;
             return;
         }
         if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) {
-            //remove preview cursor from collection
-            if (this.props.ContainingCollectionView != undefined) {
-                this.props.ContainingCollectionView.hidePreviewCursor();
-            }
+
             this._contextMenuCanOpen = false;
             if (this._mainCont.current != null && !this.topMost) {
                 this._contextMenuCanOpen = false;
-- 
cgit v1.2.3-70-g09d2


From 498f915675c1a7e6a3c3b332a2ecc77222bb4785 Mon Sep 17 00:00:00 2001
From: laurawilsonri <laura_wilson@brown.edu>
Date: Tue, 26 Feb 2019 17:46:27 -0500
Subject: removed a bunch of stuff

---
 build/index.html                                   |  2 -
 package-lock.json                                  | 71 ++++++++++++++++++++++
 package.json                                       |  5 +-
 src/PreviewTextCursor.tsx                          | 15 -----
 src/client/util/SelectionManager.ts                |  1 -
 .../views/collections/CollectionFreeFormView.tsx   |  8 ---
 src/client/views/collections/CollectionView.tsx    |  1 -
 src/client/views/nodes/DocumentView.tsx            |  2 -
 src/client/views/nodes/FormattedTextBox.tsx        | 29 ++-------
 src/fields/KeyStore.ts                             |  3 -
 src/server/database.ts                             | 11 +---
 11 files changed, 81 insertions(+), 67 deletions(-)
 delete mode 100644 src/PreviewTextCursor.tsx

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/build/index.html b/build/index.html
index 5ce31e1ce..fda212af4 100644
--- a/build/index.html
+++ b/build/index.html
@@ -2,8 +2,6 @@
 
 <head>
   <title>Dash Web</title>
-  <link href="https://fonts.googleapis.com/css?family=Fjalla+One|Hind+Siliguri:300" rel="stylesheet">
-  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
 </head>
 
 <body>
diff --git a/package-lock.json b/package-lock.json
index 761af7f92..fe90f7b96 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2137,6 +2137,11 @@
         "sha.js": "^2.4.8"
       }
     },
+    "crel": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/crel/-/crel-3.1.0.tgz",
+      "integrity": "sha512-VIGY44ERxx8lXVkOEfcB0A49OkjxkQNK+j+fHvoLy7GsGX1KKgAaQ+p9N0YgvQXu+X+ryUWGDeLx/fSI+w7+eg=="
+    },
     "cross-spawn": {
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz",
@@ -10004,6 +10009,43 @@
         "prosemirror-transform": "^1.0.0"
       }
     },
+    "prosemirror-dropcursor": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.1.1.tgz",
+      "integrity": "sha512-GeUyMO/tOEf8MXrP7Xb7UIMrfK86OGh0fnyBrHfhav4VjY9cw65mNoqHy87CklE5711AhCP5Qzfp8RL/hVKusg==",
+      "requires": {
+        "prosemirror-state": "^1.0.0",
+        "prosemirror-transform": "^1.1.0",
+        "prosemirror-view": "^1.1.0"
+      }
+    },
+    "prosemirror-example-setup": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/prosemirror-example-setup/-/prosemirror-example-setup-1.0.1.tgz",
+      "integrity": "sha512-4NKWpdmm75Zzgq/dIrypRnkBNPx+ONKyoGF42a9g3VIVv0TWglf1CBNxt5kzCgli9xdfut/xE5B42F9DR6BLHw==",
+      "requires": {
+        "prosemirror-commands": "^1.0.0",
+        "prosemirror-dropcursor": "^1.0.0",
+        "prosemirror-gapcursor": "^1.0.0",
+        "prosemirror-history": "^1.0.0",
+        "prosemirror-inputrules": "^1.0.0",
+        "prosemirror-keymap": "^1.0.0",
+        "prosemirror-menu": "^1.0.0",
+        "prosemirror-schema-list": "^1.0.0",
+        "prosemirror-state": "^1.0.0"
+      }
+    },
+    "prosemirror-gapcursor": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.0.3.tgz",
+      "integrity": "sha512-X+hJhr42PcHWiSWL+lI5f/UeOhXCxlBFb8M6O8aG1hssmaRrW7sS2/Fjg5jFV+pTdS1REFkmm1occh01FMdDIQ==",
+      "requires": {
+        "prosemirror-keymap": "^1.0.0",
+        "prosemirror-model": "^1.0.0",
+        "prosemirror-state": "^1.0.0",
+        "prosemirror-view": "^1.0.0"
+      }
+    },
     "prosemirror-history": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.0.3.tgz",
@@ -10014,6 +10056,15 @@
         "rope-sequence": "^1.2.0"
       }
     },
+    "prosemirror-inputrules": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/prosemirror-inputrules/-/prosemirror-inputrules-1.0.1.tgz",
+      "integrity": "sha512-UHy22NmwxS5WIMQYkzraDttQAF8mpP82FfbJsmKFfx6jwkR/SZa+ZhbkLY0zKQ5fBdJN7euj36JG/B5iAlrpxA==",
+      "requires": {
+        "prosemirror-state": "^1.0.0",
+        "prosemirror-transform": "^1.0.0"
+      }
+    },
     "prosemirror-keymap": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.0.1.tgz",
@@ -10023,6 +10074,17 @@
         "w3c-keyname": "^1.1.8"
       }
     },
+    "prosemirror-menu": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/prosemirror-menu/-/prosemirror-menu-1.0.5.tgz",
+      "integrity": "sha512-9Vrn7CC191v7FA4QrAkL8W1SrR73V3CRIYCDuk94R8oFVk4VxSFdoKVLHuvGzxZ8b5LCu3DMJfh86YW9uL4RkQ==",
+      "requires": {
+        "crel": "^3.0.0",
+        "prosemirror-commands": "^1.0.0",
+        "prosemirror-history": "^1.0.0",
+        "prosemirror-state": "^1.0.0"
+      }
+    },
     "prosemirror-model": {
       "version": "1.7.0",
       "resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.7.0.tgz",
@@ -10039,6 +10101,15 @@
         "prosemirror-model": "^1.0.0"
       }
     },
+    "prosemirror-schema-list": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.0.2.tgz",
+      "integrity": "sha512-IJ4DEpUEymfO+NNA4DAgCMF39XiQqpmCoPYY3SXa1jYcVgObGpGfJlSjZYVFEpimoLI7/mLoOLDhCtpGCRhTfg==",
+      "requires": {
+        "prosemirror-model": "^1.0.0",
+        "prosemirror-transform": "^1.0.0"
+      }
+    },
     "prosemirror-state": {
       "version": "1.2.2",
       "resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.2.2.tgz",
diff --git a/package.json b/package.json
index bd4655816..8568a7bef 100644
--- a/package.json
+++ b/package.json
@@ -75,7 +75,6 @@
     "express-validator": "^5.3.1",
     "expressjs": "^1.0.1",
     "flexlayout-react": "^0.3.3",
-    "font-awesome": "^4.7.0",
     "golden-layout": "^1.5.9",
     "jsonwebtoken": "^8.4.0",
     "jsx-to-string": "^1.4.0",
@@ -92,6 +91,7 @@
     "passport": "^0.4.0",
     "passport-local": "^1.0.0",
     "prosemirror-commands": "^1.0.7",
+    "prosemirror-example-setup": "^1.0.1",
     "prosemirror-history": "^1.0.3",
     "prosemirror-keymap": "^1.0.1",
     "prosemirror-model": "^1.7.0",
@@ -103,7 +103,6 @@
     "react": "^16.5.2",
     "react-dimensions": "^1.3.1",
     "react-dom": "^16.7.0",
-    "react-fontawesome": "^1.6.1",
     "react-golden-layout": "^1.0.6",
     "react-image-lightbox": "^5.1.0",
     "react-jsx-parser": "^1.13.0",
@@ -117,4 +116,4 @@
     "url-loader": "^1.1.2",
     "uuid": "^3.3.2"
   }
-}
+}
\ No newline at end of file
diff --git a/src/PreviewTextCursor.tsx b/src/PreviewTextCursor.tsx
deleted file mode 100644
index 6818bf28c..000000000
--- a/src/PreviewTextCursor.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React = require("react");
-import { observer } from "mobx-react";
-
-@observer
-export class PreviewTextCursor extends React.Component {
-
-    render() {
-        return (
-            <div>
-
-            </div>
-        )
-    };
-
-}
\ No newline at end of file
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index c349e7631..1a711ae64 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -8,7 +8,6 @@ export namespace SelectionManager {
 
         @action
         SelectDoc(doc: DocumentView, ctrlPressed: boolean): void {
-
             // if doc is not in SelectedDocuments, add it
             if (!ctrlPressed) {
                 manager.SelectedDocuments = [];
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index cd88c931b..63ecec0df 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -2,8 +2,6 @@ import { observable, action, computed } from "mobx";
 import { observer } from "mobx-react";
 import { Document } from "../../../fields/Document";
 import { FieldWaiting } from "../../../fields/Field";
-import { Server } from "tls";
-import { RichTextField } from "../../../fields/RichTextField";
 import { KeyStore } from "../../../fields/KeyStore";
 import { ListField } from "../../../fields/ListField";
 import { TextField } from "../../../fields/TextField";
@@ -12,7 +10,6 @@ import { Transform } from "../../util/Transform";
 import { undoBatch } from "../../util/UndoManager";
 import { CollectionDockingView } from "../collections/CollectionDockingView";
 import { CollectionSchemaView } from "../collections/CollectionSchemaView";
-import { CollectionTreeView } from "../collections/CollectionTreeView";
 import { CollectionView } from "../collections/CollectionView";
 import { CollectionFreeFormDocumentView } from "../nodes/CollectionFreeFormDocumentView";
 import { DocumentView } from "../nodes/DocumentView";
@@ -41,8 +38,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
     @observable
     private _previewCursorVisible: boolean = false;
 
-    @computed get colFocus(): boolean { return this.props.CollectionView.isFocusOn() }
-
     @computed get panX(): number { return this.props.Document.GetNumber(KeyStore.PanX, 0) }
     @computed get panY(): number { return this.props.Document.GetNumber(KeyStore.PanY, 0) }
     @computed get scale(): number { return this.props.Document.GetNumber(KeyStore.Scale, 1); }
@@ -165,7 +160,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
 
     @action
     onKeyDown = (e: React.KeyboardEvent<Element>) => {
-        console.log("KEY PRESSED");
         //if not these keys, make a textbox if preview cursor is active!
         if (!e.ctrlKey && !e.altKey && !e.shiftKey) {
             if (this._previewCursorVisible) {
@@ -174,9 +168,7 @@ export class CollectionFreeFormView extends CollectionViewBase {
                 let newBox = Documents.TextDocument({ width: 200, height: 100, x: x, y: y, title: "new" });
                 //set text to be the typed key and get focus on text box
                 this.props.CollectionView.addDocument(newBox);
-                newBox.SetText(KeyStore.Data, e.key);
                 newBox.SetNumber(KeyStore.SelectOnLoaded, 1);
-
                 //remove cursor from screen
                 this._previewCursorVisible = false;
             }
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 11cc6d28e..35ac48177 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -11,7 +11,6 @@ import { CollectionFreeFormView } from "./CollectionFreeFormView";
 import { CollectionDockingView } from "./CollectionDockingView";
 import { CollectionSchemaView } from "./CollectionSchemaView";
 import { CollectionViewProps } from "./CollectionViewBase";
-var ReactDOM = require('react-dom');
 import { CollectionTreeView } from "./CollectionTreeView";
 import { Field } from "../../../fields/Field";
 
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 9f80c4e3a..50dc9ddc1 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -113,14 +113,12 @@ export class DocumentView extends React.Component<DocumentViewProps> {
         }
     }
 
-
     onPointerMove = (e: PointerEvent): void => {
         if (e.cancelBubble) {
             this._contextMenuCanOpen = false;
             return;
         }
         if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) {
-
             this._contextMenuCanOpen = false;
             if (this._mainCont.current != null && !this.topMost) {
                 this._contextMenuCanOpen = false;
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 63d00a310..a92821ed6 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -2,24 +2,22 @@ import { action, IReactionDisposer, reaction } from "mobx";
 import { baseKeymap } from "prosemirror-commands";
 import { history, redo, undo } from "prosemirror-history";
 import { keymap } from "prosemirror-keymap";
+const { exampleSetup } = require("prosemirror-example-setup")
 import { schema } from "prosemirror-schema-basic";
-import { Transform } from "prosemirror-transform";
-import { EditorState, Transaction } from "prosemirror-state";
+import { EditorState, Transaction, } from "prosemirror-state";
 import { EditorView } from "prosemirror-view";
-import { Node } from "prosemirror-model";
 import { Opt, FieldWaiting, FieldValue } from "../../../fields/Field";
 import "./FormattedTextBox.scss";
 import { KeyStore } from "../../../fields/KeyStore";
 import React = require("react")
 import { RichTextField } from "../../../fields/RichTextField";
 import { FieldViewProps, FieldView } from "./FieldView";
-import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView";
-import { observer } from "mobx-react";
-import { Schema, DOMParser } from "prosemirror-model"
 import { Plugin } from 'prosemirror-state'
 import { Decoration, DecorationSet } from 'prosemirror-view'
 
 
+
+
 // FormattedTextBox: Displays an editable plain text node that maps to a specified Key of a Document
 //
 //  HTML Markup:  <FormattedTextBox Doc={Document's ID} FieldKey={Key's name + "Key"}
@@ -42,7 +40,6 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
     private _ref: React.RefObject<HTMLDivElement>;
     private _editorView: Opt<EditorView>;
     private _reactionDisposer: Opt<IReactionDisposer>;
-    private _lastTextState = "";
 
     constructor(props: FieldViewProps) {
         super(props);
@@ -58,24 +55,9 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
             this._editorView.updateState(state);
             const { doc, fieldKey } = this.props;
             doc.SetData(fieldKey, JSON.stringify(state.toJSON()), RichTextField);
-            this._lastTextState = JSON.stringify(state.toJSON);
         }
     }
 
-    //enables textboxes to be created with preexisting text or placeholder text 
-    //this method is passed in as part of the config the editor state in componentDidMount()
-    placeholderPlugin(text: string) {
-        return new Plugin({
-            props: {
-                decorations(state) {
-                    let doc = state.doc
-                    if (doc.childCount == 1 && doc.firstChild && doc.firstChild.isTextblock && doc.firstChild.content.size == 0)
-                        return DecorationSet.create(doc, [Decoration.widget(1, document.createTextNode(text))])
-                }
-            }
-        })
-    }
-
     componentDidMount() {
         let state: EditorState;
         const { doc, fieldKey } = this.props;
@@ -85,8 +67,8 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
                 history(),
                 keymap({ "Mod-z": undo, "Mod-y": redo }),
                 keymap(baseKeymap),
-                //sets the placeholder text to what's in KeyStore.Text!
             ]
+
         };
 
         let field = doc.GetT(fieldKey, RichTextField);
@@ -134,7 +116,6 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
     @action
     onChange(e: React.ChangeEvent<HTMLInputElement>) {
         const { fieldKey, doc } = this.props;
-        this._lastTextState = e.target.value;
         doc.SetData(fieldKey, e.target.value, RichTextField);
     }
     onPointerDown = (e: React.PointerEvent): void => {
diff --git a/src/fields/KeyStore.ts b/src/fields/KeyStore.ts
index 6b5fafe05..662574396 100644
--- a/src/fields/KeyStore.ts
+++ b/src/fields/KeyStore.ts
@@ -26,10 +26,7 @@ export namespace KeyStore {
     export const Caption = new Key("Caption");
     export const ActiveFrame = new Key("ActiveFrame");
     export const DocumentText = new Key("DocumentText");
-    //used for setting the text of a text document
-    export const Text = new Key("Text");
     //determines whether doc views will be selected when they are first loaded
-    //should be NumberField where 0 = false and 1 = true
     //currently only implemented for FormattedTextView
     export const SelectOnLoaded = new Key("SelectOnLoaded");
 }
diff --git a/src/server/database.ts b/src/server/database.ts
index dbf335c0a..07c5819ab 100644
--- a/src/server/database.ts
+++ b/src/server/database.ts
@@ -1,6 +1,6 @@
 import { action, configure } from 'mobx';
-import * as mongodb from "mongodb"
-import { ObjectID } from "mongodb"
+import * as mongodb from 'mongodb';
+import { ObjectID } from 'mongodb';
 import { Transferable } from './Message';
 import { Utils } from '../Utils';
 
@@ -8,15 +8,10 @@ export class Database {
     public static Instance = new Database()
     private MongoClient = mongodb.MongoClient;
     private url = 'mongodb://localhost:27017/Dash';
-
     private db?: mongodb.Db;
 
     constructor() {
         this.MongoClient.connect(this.url, (err, client) => {
-            if (err) {
-                console.log(err.message);
-                throw err;
-            }
             this.db = client.db()
         })
     }
@@ -83,4 +78,4 @@ export class Database {
     public print() {
         console.log("db says hi!")
     }
-}
\ No newline at end of file
+}
-- 
cgit v1.2.3-70-g09d2


From 09f0bebe4ac64250769297ccf64c33217b8db66a Mon Sep 17 00:00:00 2001
From: Tyler Schicke <tyler_schicke@brown.edu>
Date: Wed, 27 Feb 2019 15:33:32 -0500
Subject: Fixes for context menu stuff

---
 deploy/debug/test.html                             | 13 ++++++
 package-lock.json                                  |  8 +++-
 src/client/views/Main.tsx                          |  1 -
 .../views/collections/CollectionDockingView.tsx    |  2 +-
 .../views/collections/CollectionFreeFormView.tsx   |  2 -
 src/client/views/nodes/DocumentView.tsx            | 17 +++-----
 src/debug/Test.tsx                                 | 46 ++++++++++++++++++++++
 webpack.config.js                                  |  1 +
 8 files changed, 73 insertions(+), 17 deletions(-)
 create mode 100644 deploy/debug/test.html
 create mode 100644 src/debug/Test.tsx

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/deploy/debug/test.html b/deploy/debug/test.html
new file mode 100644
index 000000000..58febbc81
--- /dev/null
+++ b/deploy/debug/test.html
@@ -0,0 +1,13 @@
+<html>
+
+<head>
+    <title>Test view</title>
+    <link href="https://fonts.googleapis.com/css?family=Fjalla+One|Hind+Siliguri:300" rel="stylesheet">
+</head>
+
+<body>
+    <div id="root"></div>
+    <script src="../test.js"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index d74c77819..ecfa3d6d8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3389,11 +3389,13 @@
         },
         "balanced-match": {
           "version": "1.0.0",
-          "bundled": true
+          "bundled": true,
+          "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
+          "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
@@ -3410,7 +3412,8 @@
         },
         "concat-map": {
           "version": "0.0.1",
-          "bundled": true
+          "bundled": true,
+          "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
@@ -3539,6 +3542,7 @@
         "minimatch": {
           "version": "3.0.4",
           "bundled": true,
+          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 17dda899d..61ad66c72 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -30,7 +30,6 @@ window.addEventListener("dragover", function (e) {
     e.preventDefault();
 }, false)
 document.addEventListener("pointerdown", action(function (e: PointerEvent) {
-    console.log(ContextMenu);
     if (!ContextMenu.Instance.intersects(e.pageX, e.pageY)) {
         ContextMenu.Instance.clearItems()
     }
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 5fb632469..cb978c1ba 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -245,7 +245,7 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
     render() {
         return (
             <div className="collectiondockingview-container" id="menuContainer"
-                onPointerDown={this.onPointerDown} onPointerUp={this.onPointerUp} onContextMenu={(e) => e.preventDefault()} ref={this._containerRef}
+                onPointerDown={this.onPointerDown} onPointerUp={this.onPointerUp} ref={this._containerRef}
                 style={{
                     width: "100%",
                     height: "100%",
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index 12909c151..1f8d76432 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -83,7 +83,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
     @action
     onPointerMove = (e: PointerEvent): void => {
         if (!e.cancelBubble && this.props.active()) {
-            e.preventDefault();
             e.stopPropagation();
             let x = this.props.Document.GetNumber(KeyStore.PanX, 0);
             let y = this.props.Document.GetNumber(KeyStore.PanY, 0);
@@ -230,7 +229,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
             <div className="collectionfreeformview-container"
                 onPointerDown={this.onPointerDown}
                 onWheel={this.onPointerWheel}
-                onContextMenu={(e) => e.preventDefault()}
                 onDrop={this.onDrop.bind(this)}
                 onDragOver={this.onDragOver}
                 style={{ borderWidth: `${COLLECTION_BORDER_WIDTH}px`, }}
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index c579b7142..6e14df229 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -80,7 +80,6 @@ export class DocumentView extends React.Component<DocumentViewProps> {
 
     private _mainCont = React.createRef<HTMLDivElement>();
     private _documentBindings: any = null;
-    private _contextMenuCanOpen = false;
     private _downX: number = 0;
     private _downY: number = 0;
 
@@ -99,7 +98,6 @@ export class DocumentView extends React.Component<DocumentViewProps> {
             CollectionDockingView.Instance.StartOtherDrag(this._mainCont.current!, this.props.Document);
             e.stopPropagation();
         } else {
-            this._contextMenuCanOpen = true;
             if (this.active && !e.isDefaultPrevented()) {
                 e.stopPropagation();
                 if (e.buttons === 2) {
@@ -115,13 +113,10 @@ export class DocumentView extends React.Component<DocumentViewProps> {
 
     onPointerMove = (e: PointerEvent): void => {
         if (e.cancelBubble) {
-            this._contextMenuCanOpen = false;
             return;
         }
         if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) {
-            this._contextMenuCanOpen = false;
             if (this._mainCont.current != null && !this.topMost) {
-                this._contextMenuCanOpen = false;
                 const [left, top] = this.props.ScreenToLocalTransform().inverse().transformPoint(0, 0);
                 let dragData: { [id: string]: any } = {};
                 dragData["documentView"] = this;
@@ -129,7 +124,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
                 dragData["yOffset"] = e.y - top;
                 DragManager.StartDrag(this._mainCont.current, dragData, {
                     handlers: {
-                        dragComplete: action((e: DragManager.DragCompleteEvent) => { }),
+                        dragComplete: action(() => { }),
                     },
                     hideSource: true
                 })
@@ -148,7 +143,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
         }
     }
 
-    deleteClicked = (e: React.MouseEvent): void => {
+    deleteClicked = (): void => {
         if (this.props.RemoveDocument) {
             this.props.RemoveDocument(this.props.Document);
         }
@@ -168,13 +163,14 @@ export class DocumentView extends React.Component<DocumentViewProps> {
 
     @action
     onContextMenu = (e: React.MouseEvent): void => {
-        e.preventDefault()
         e.stopPropagation();
-        if (!SelectionManager.IsSelected(this) || !this._contextMenuCanOpen) {
+        let moved = Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3;
+        if (moved || e.isDefaultPrevented()) {
+            e.preventDefault()
             return;
         }
+        e.preventDefault()
 
-        ContextMenu.Instance.clearItems()
         ContextMenu.Instance.addItem({ description: "Full Screen", event: this.fullScreenClicked })
         ContextMenu.Instance.addItem({ description: "Open Right", event: () => CollectionDockingView.Instance.AddRightSplit(this.props.Document) })
         ContextMenu.Instance.addItem({ description: "Freeform", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Freeform) })
@@ -193,7 +189,6 @@ export class DocumentView extends React.Component<DocumentViewProps> {
     }
 
     @computed get mainContent() {
-        var val = this.props.Document.Id;
         return <JsxParser
             components={{ FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView, CollectionView, WebView }}
             bindings={this._documentBindings}
diff --git a/src/debug/Test.tsx b/src/debug/Test.tsx
new file mode 100644
index 000000000..7bc70615f
--- /dev/null
+++ b/src/debug/Test.tsx
@@ -0,0 +1,46 @@
+import * as React from 'react';
+import * as ReactDOM from 'react-dom';
+
+class TestInternal extends React.Component {
+    onContextMenu = (e: React.MouseEvent) => {
+        console.log("Internal");
+        e.stopPropagation();
+    }
+
+    onPointerDown = (e: React.MouseEvent) => {
+        console.log("pointer down")
+        e.preventDefault();
+    }
+
+    render() {
+        return <div onContextMenu={this.onContextMenu} onPointerDown={this.onPointerDown}
+            onPointerUp={this.onPointerDown}>Hello world</div>
+    }
+}
+
+class TestChild extends React.Component {
+    onContextMenu = () => {
+        console.log("Child");
+    }
+
+    render() {
+        return <div onContextMenu={this.onContextMenu}><TestInternal /></div>
+    }
+}
+
+class TestParent extends React.Component {
+    onContextMenu = () => {
+        console.log("Parent");
+    }
+
+    render() {
+        return <div onContextMenu={this.onContextMenu}><TestChild /></div>
+    }
+}
+
+ReactDOM.render((
+    <div style={{ position: "absolute", width: "100%", height: "100%" }}>
+        <TestParent />
+    </div>),
+    document.getElementById('root')
+);
\ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
index 2a29844e8..900802d7d 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -7,6 +7,7 @@ module.exports = {
   entry: {
     bundle: ["./src/client/views/Main.tsx", 'webpack-hot-middleware/client?reload=true'],
     viewer: ["./src/debug/Viewer.tsx", 'webpack-hot-middleware/client?reload=true'],
+    test: ["./src/debug/Test.tsx", 'webpack-hot-middleware/client?reload=true'],
   },
   devtool: "source-map",
   node: {
-- 
cgit v1.2.3-70-g09d2

