aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-04-03 20:23:15 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-04-03 20:23:15 -0400
commitadabfbea2b034beb310530aef9cc8b206e260b67 (patch)
tree7cae910fcb760ddfa5b8a580e0bfb50ca248a5ca /src/client/views/collections/CollectionSubView.tsx
parent5414cc78dfb650954c9b6fef8115a5945ea8d6a6 (diff)
added rootSelected() to make forceActive work better
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 70927cf22..d1d6ae3c1 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -34,6 +34,7 @@ export interface CollectionViewProps extends FieldViewProps {
PanelHeight: () => number;
VisibleHeight?: () => number;
setPreviewCursor?: (func: (x: number, y: number, drag: boolean) => void) => void;
+ rootSelected: () => boolean;
fieldKey: string;
}
@@ -95,6 +96,10 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
this.props.Document.resolvedDataDoc ? this.props.Document : Doc.GetProto(this.props.Document)); // if the layout document has a resolvedDataDoc, then we don't want to get its parent which would be the unexpanded template
}
+ rootSelected = () => {
+ return this.props.isSelected() || (this.props.Document.rootDocument || this.props.Document.forceActive ? this.props.rootSelected() : false);
+ }
+
// The data field for rendering this collection will be on the this.props.Document unless we're rendering a template in which case we try to use props.DataDoc.
// When a document has a DataDoc but it's not a template, then it contains its own rendering data, but needs to pass the DataDoc through
// to its children which may be templates.