diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-05-16 21:02:18 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-05-16 21:02:18 -0400 |
commit | 0c019112791138304eaaeea768d254981322ec55 (patch) | |
tree | 849c39d9d4a74b6c61ab0eeead98c6bdb7e68f7a /src/client/views/nodes/DocumentContentsView.tsx | |
parent | 530dc40f7519b8288d91db61103468ab713dfbdd (diff) | |
parent | a2333e76fea26d2ce03272947d8a89973489fa46 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/nodes/DocumentContentsView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentContentsView.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx index ace8d4aa5..d2cb11586 100644 --- a/src/client/views/nodes/DocumentContentsView.tsx +++ b/src/client/views/nodes/DocumentContentsView.tsx @@ -46,10 +46,16 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & { layoutKey: string, }> { @computed get layout(): string { - return StrCast(this.props.Document[this.props.layoutKey], - this.props.Document.data ? + const layout = Cast(this.props.Document[this.props.layoutKey], "string"); + if (layout === undefined) { + return this.props.Document.data ? "<FieldView {...props} fieldKey='data' />" : - KeyValueBox.LayoutString(this.props.Document.proto ? "proto" : "")); + KeyValueBox.LayoutString(this.props.Document.proto ? "proto" : ""); + } else if (typeof layout === "string") { + return layout; + } else { + return "<p>Loading layout</p>"; + } } CreateBindings(): JsxBindings { |