aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocComponent.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-04-09 11:44:56 -0400
committerbobzel <zzzman@gmail.com>2025-04-09 11:44:56 -0400
commit4f236271c39380f15409b8fb38b2f6e2bae8df9f (patch)
tree01a8842ad4511cacc16f04f08d9fa049849c572b /src/client/views/DocComponent.tsx
parent348329448573fcaf18ffc4e1200888e5c38a7d1b (diff)
cleaned up color setting for templates so that instances can override template default color.
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r--src/client/views/DocComponent.tsx19
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() {