From 486e84c725b60a1dd1312c7903a4d248aa44d4e8 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Mon, 30 Mar 2020 17:10:04 -0400 Subject: fixed captions and got rid of inappropriate references to Doc.expandTemplate --- .../views/collections/CollectionSchemaView.tsx | 5 ++-- src/client/views/nodes/DocumentContentsView.tsx | 33 ++++++++++++--------- src/client/views/nodes/DocumentView.tsx | 34 +++++++--------------- 3 files changed, 31 insertions(+), 41 deletions(-) (limited to 'src/client/views') diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 6eeceb552..a4502cced 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -119,11 +119,10 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { @computed get previewPanel() { - const layoutDoc = this.previewDocument ? Doc.expandTemplateLayout(this.previewDocument, this.props.DataDoc) : undefined; return
boolean, select: (ctrl: boolean) => void, layoutKey: string, + forceLayout?: string, + forceFieldKey?: string }> { @computed get layout(): string { TraceMobx(); @@ -94,20 +96,23 @@ export class DocumentContentsView extends React.Component 12 || !this.layout || !this.layoutDoc) ? (null) : - + : + { console.log(test); }} - />; + onError={(test: any) => { console.log(test); }} + />; } } \ No newline at end of file diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 080c722b2..1dee25c51 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -981,25 +981,6 @@ export class DocumentView extends DocComponent(Docu return anchor.type === DocumentType.AUDIO && NumCast(ept) ? false : true; } - // bcz: ARGH! these two are the same as in DocumentContentsView (without the _). They should be reconciled to be the same functions... - get _dataDoc() { - if (this.props.DataDoc === undefined && typeof Doc.LayoutField(this.props.Document) !== "string") { - // if there is no dataDoc (ie, we're not rendering a template layout), but this document has a layout document (not a layout string), - // then we render the layout document as a template and use this document as the data context for the template layout. - const proto = Doc.GetProto(this.props.Document); - return proto instanceof Promise ? undefined : proto; - } - return this.props.DataDoc instanceof Promise ? undefined : this.props.DataDoc; - } - get _layoutDoc() { - if (this.props.LayoutDoc || (this.props.DataDoc === undefined && typeof Doc.LayoutField(this.props.Document) !== "string")) { - // if there is no dataDoc (ie, we're not rendering a template layout), but this document has a layout document (not a layout string), - // then we render the layout document as a template and use this document as the data context for the template layout. - return Doc.expandTemplateLayout(this.props.LayoutDoc?.() || Doc.Layout(this.props.Document), this.props.Document); - } - return Doc.Layout(this.props.Document); - } - @computed get innards() { TraceMobx(); if (!this.props.PanelWidth()) { @@ -1022,11 +1003,16 @@ export class DocumentView extends DocComponent(Docu
); const captionView = (!showCaption ? (null) :
- +
); const titleView = (!showTitle ? (null) :