diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-05 19:37:48 -0500 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-05 19:37:48 -0500 |
commit | 6a13071a695732b2235f988278c52d0072af0fb5 (patch) | |
tree | 94d6ccf16572463520fd744e41988b1dc8c7b7e3 /src/views/nodes/FieldView.tsx | |
parent | 41afca0448b4e75459fc8aeb53192f6a44aa2b18 (diff) | |
parent | 6e66f8b227c730e07863a93a8bce5ee0d51d2ddc (diff) |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web into scripting
Diffstat (limited to 'src/views/nodes/FieldView.tsx')
-rw-r--r-- | src/views/nodes/FieldView.tsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/views/nodes/FieldView.tsx b/src/views/nodes/FieldView.tsx index 6c1cd956b..2a2355a23 100644 --- a/src/views/nodes/FieldView.tsx +++ b/src/views/nodes/FieldView.tsx @@ -1,5 +1,4 @@ import React = require("react") -import { DocumentView } from "./DocumentView"; import { Document } from "../../fields/Document"; import { observer } from "mobx-react"; import { computed } from "mobx"; @@ -7,24 +6,26 @@ import { Field, Opt } from "../../fields/Field"; import { TextField } from "../../fields/TextField"; import { NumberField } from "../../fields/NumberField"; import { RichTextField } from "../../fields/RichTextField"; -import { FieldTextBox } from "./FieldTextBox"; +import { FormattedTextBox } from "./FormattedTextBox"; import { ImageField } from "../../fields/ImageField"; import { ImageBox } from "./ImageBox"; import { Key } from "../../fields/Key"; +import { DocumentView } from "./DocumentView"; // // these properties get assigned through the render() method of the DocumentView when it creates this node. // However, that only happens because the properties are "defined" in the markup for the field view. -// See the LayoutString method on each field view : ImageBox, FieldTextBox, etc. +// See the LayoutString method on each field view : ImageBox, FormattedTextBox, etc. // export interface FieldViewProps { fieldKey: Key; doc: Document; - documentViewContainer: DocumentView + DocumentViewForField: Opt<DocumentView> } @observer export class FieldView extends React.Component<FieldViewProps> { + public static LayoutString(fieldType: string) { return `<${fieldType} doc={Document} DocumentViewForField={DocumentView} fieldKey={DataKey} />`; } @computed get field(): Opt<Field> { const { doc, fieldKey } = this.props; @@ -39,7 +40,7 @@ export class FieldView extends React.Component<FieldViewProps> { return <p>{field.Data}</p> } else if (field instanceof RichTextField) { - return <FieldTextBox {...this.props} /> + return <FormattedTextBox {...this.props} /> } else if (field instanceof ImageField) { return <ImageBox {...this.props} /> |