From 7b7f1fb2865522da414314afbdb09847e7a9409c Mon Sep 17 00:00:00 2001
From: yipstanley <stanley_yip@brown.edu>
Date: Sat, 13 Apr 2019 18:08:27 -0400
Subject: asdfjkl updates

---
 src/client/views/DocumentDecorations.tsx | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

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

diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 2dc496bc1..a72f02f14 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -14,7 +14,7 @@ import './DocumentDecorations.scss';
 import { DocumentView } from "./nodes/DocumentView";
 import { LinkMenu } from "./nodes/LinkMenu";
 import React = require("react");
-import { FieldWaiting } from "../../fields/Field";
+import { FieldWaiting, Field } from "../../fields/Field";
 import { emptyFunction } from "../../Utils";
 import { Main } from "./Main";
 import { undo } from "prosemirror-history";
@@ -74,7 +74,20 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
                 // TODO: Change field with switch statement
             }
             else {
-                this._title = "changed";
+                if (this._documents.length > 0) {
+                    let field = this._documents[0].props.Document.Get(this._fieldKey);
+                    if (field instanceof TextField) {
+                        this._documents.forEach(d => {
+                            d.props.Document.Set(this._fieldKey, new TextField(this._title));
+                        });
+                    }
+                    else if (field instanceof NumberField) {
+                        this._documents.forEach(d => {
+                            d.props.Document.Set(this._fieldKey, new NumberField(+this._title))
+                        });
+                    }
+                    this._title = "changed";
+                }
             }
             e.target.blur();
         }
-- 
cgit v1.2.3-70-g09d2

