diff options
author | bob <bcz@cs.brown.edu> | 2019-02-25 12:38:47 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-02-25 12:38:47 -0500 |
commit | c439f11ba9695703697f7abc53a7cc2fd2d5c1a2 (patch) | |
tree | d3977cb05f37ec77eadb782c65d4766777dc0e18 /src/client/views/collections/CollectionView.tsx | |
parent | e57c8ed3944bf737afdb2f564d159a53f8a6b1c6 (diff) |
fixes for dropping documents without a know height.
Diffstat (limited to 'src/client/views/collections/CollectionView.tsx')
-rw-r--r-- | src/client/views/collections/CollectionView.tsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx index 90080ab43..88c15da07 100644 --- a/src/client/views/collections/CollectionView.tsx +++ b/src/client/views/collections/CollectionView.tsx @@ -11,6 +11,7 @@ import { CollectionFreeFormView } from "./CollectionFreeFormView"; import { CollectionDockingView } from "./CollectionDockingView"; import { CollectionSchemaView } from "./CollectionSchemaView"; import { CollectionViewProps } from "./CollectionViewBase"; +import { Field } from "../../../fields/Field"; @@ -39,9 +40,13 @@ export class CollectionView extends React.Component<CollectionViewProps> { } @action addDocument = (doc: Document): void => { - //TODO This won't create the field if it doesn't already exist - const value = this.props.Document.GetData(this.props.fieldKey, ListField, new Array<Document>()) - value.push(doc); + if (this.props.Document.Get(this.props.fieldKey) instanceof Field) { + //TODO This won't create the field if it doesn't already exist + const value = this.props.Document.GetData(this.props.fieldKey, ListField, new Array<Document>()) + value.push(doc); + } else { + this.props.Document.SetData(this.props.fieldKey, [doc], ListField); + } } @action |