diff options
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r-- | src/client/views/DocComponent.tsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index d33f3b713..b8b70d9d2 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -49,6 +49,13 @@ export function DocComponent<P extends DocComponentProps>() { get rootDoc() { return DocCast(this.Document.rootDocument, this.Document); } + + /** + * Whether the doc is a sub-componentn of a compound template doc. + */ + get isTemplate() { + return this.rootDoc !== this.layoutDoc; + } /** * This is the document being rendered by the React component. In the * case of a compound template, this will be the expanded template Doc @@ -110,6 +117,12 @@ export function ViewBoxBaseComponent<P extends FieldViewProps>() { return DocCast(this.Document.rootDocument, this.Document); } /** + * Whether the doc is a sub-componentn of a compound template doc. + */ + get isTemplate() { + return this.rootDoc !== this.layoutDoc; + } + /** * This is the document being rendered by the React component. In the * case of a compound template, this will be the expanded template Doc * that represents the component of the compound Doc being rendered. @@ -184,6 +197,12 @@ export function ViewBoxAnnotatableComponent<P extends FieldViewProps>() { return DocCast(this.Document.rootDocument, this.Document); } /** + * Whether the doc is a sub-componentn of a compound template doc. + */ + get isTemplate() { + return this.rootDoc !== this.layoutDoc; + } + /** * This is the document being rendered. It may be a template so it may or may no inherit from the data doc. */ @computed get layoutDoc() { |