From 9cf013c5b64af47d5199ef8168a5af6c29461ed9 Mon Sep 17 00:00:00 2001
From: laurawilsonri <laura_wilson@brown.edu>
Date: Sat, 23 Feb 2019 18:20:24 -0500
Subject: stugggggglin

---
 src/client/views/nodes/FormattedTextBox.tsx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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

diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index f6bd0c0f8..4bec129e5 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -3,8 +3,10 @@ import { baseKeymap } from "prosemirror-commands";
 import { history, redo, undo } from "prosemirror-history";
 import { keymap } from "prosemirror-keymap";
 import { schema } from "prosemirror-schema-basic";
+import { Transform } from "prosemirror-transform";
 import { EditorState, Transaction } from "prosemirror-state";
 import { EditorView } from "prosemirror-view";
+import { Node } from "prosemirror-model";
 import { Opt, FieldWaiting, FieldValue } from "../../../fields/Field";
 import { SelectionManager } from "../../util/SelectionManager";
 import "./FormattedTextBox.scss";
@@ -13,6 +15,7 @@ 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"
 
 
 // FormattedTextBox: Displays an editable plain text node that maps to a specified Key of a Document
@@ -55,10 +58,20 @@ export class FormattedTextBox extends React.Component<FieldViewProps> {
         }
     }
 
+    setText(txt: string) {
+        let tr = new Transaction(new Node());
+        let node = new Node();
+        node.text = txt;
+        tr.insert(0, node);
+
+        this.dispatchTransaction(tr);
+    }
+
     componentDidMount() {
         let state: EditorState;
         const { doc, fieldKey } = this.props;
         const config = {
+            doc: new Node(),
             schema,
             plugins: [
                 history(),
-- 
cgit v1.2.3-70-g09d2

