From e79e53d78546501fc855b76a84f000289ed7433a Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 4 Feb 2019 10:44:30 -0500 Subject: split out common code into CollectionViewBase. organized a few other things, too. --- src/views/nodes/FieldView.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/views/nodes/FieldView.tsx') diff --git a/src/views/nodes/FieldView.tsx b/src/views/nodes/FieldView.tsx index eec63256d..6c1cd956b 100644 --- a/src/views/nodes/FieldView.tsx +++ b/src/views/nodes/FieldView.tsx @@ -1,5 +1,6 @@ import React = require("react") -import { DocumentFieldViewProps } from "./DocumentView"; +import { DocumentView } from "./DocumentView"; +import { Document } from "../../fields/Document"; import { observer } from "mobx-react"; import { computed } from "mobx"; import { Field, Opt } from "../../fields/Field"; @@ -9,9 +10,21 @@ import { RichTextField } from "../../fields/RichTextField"; import { FieldTextBox } from "./FieldTextBox"; import { ImageField } from "../../fields/ImageField"; import { ImageBox } from "./ImageBox"; +import { Key } from "../../fields/Key"; + +// +// 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. +// +export interface FieldViewProps { + fieldKey: Key; + doc: Document; + documentViewContainer: DocumentView +} @observer -export class FieldView extends React.Component { +export class FieldView extends React.Component { @computed get field(): Opt { const { doc, fieldKey } = this.props; -- cgit v1.2.3-70-g09d2