aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/StyleProvider.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/StyleProvider.tsx')
-rw-r--r--src/client/views/StyleProvider.tsx17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index b52f17102..ca089a2fc 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -83,7 +83,6 @@ export function SetFilterOpener(func: () => void) {
export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & DocumentViewProps>, property: string) {
const remoteDocHeader = 'author;author_date;noMargin';
const isCaption = property.includes(':caption');
- const isAnchor = property.includes(':anchor');
const isNonTransparent = property.includes(':nonTransparent');
const isNonTransparentLevel = isNonTransparent ? Number(property.replace(/.*:nonTransparent([0-9]+).*/, '$1')) : 0; // property.includes(':nonTransparent');
const isAnnotated = property.includes(':annotated');
@@ -251,14 +250,16 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps &
const dataKey = doc ? Doc.LayoutDataKey(doc) : '';
const usePath = StrCast(doc?.[dataKey + '_usePath']);
const alternate = usePath.includes(':hover') ? ( isHovering?.() ? '_' + usePath.replace(':hover','') : '') : usePath ? "_" +usePath:usePath;
- let docColor:Opt<string> = layoutDoc &&
- StrCast(alternate ? layoutDoc['backgroundColor' + alternate]:undefined,
+ const colorKey = doc?.layout_isSvg ? "fillColor" : "backgroundColor";
+ const docColorFn = (key: string) => layoutDoc &&
+ StrCast(alternate ? layoutDoc[key + alternate]:undefined,
DocCast(doc.rootDocument)
- ? StrCast(layoutDoc.backgroundColor, StrCast(DocCast(doc.rootDocument)!.backgroundColor)) // for nested templates: use template's color, then root doc's color
+ ? StrCast(layoutDoc[key], StrCast(DocCast(doc.rootDocument)![key])) // for nested templates: use template's color, then root doc's color
: layoutDoc === doc
- ? StrCast(doc.backgroundColor)
- : StrCast(StrCast(Doc.GetT(layoutDoc, 'backgroundColor', 'string', true), StrCast(doc.backgroundColor, StrCast(layoutDoc.backgroundColor)) // otherwise, use expanded template coloor, then root doc's color, then template's inherited color
- )));
+ ? StrCast(doc[key])
+ : StrCast(StrCast(Doc.GetT(layoutDoc, key, 'string', true), StrCast(doc[key], StrCast(layoutDoc[key])) // otherwise, use expanded template coloor, then root doc's color, then template's inherited color
+ )))
+ let docColor = docColorFn(colorKey);
// prettier-ignore
switch (layoutDoc?.type) {
@@ -266,11 +267,11 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps &
case DocumentType.PRES: docColor = docColor || 'transparent'; break;
case DocumentType.FONTICON: docColor = boxBackground ? undefined : docColor || SnappingManager.userBackgroundColor; break;
case DocumentType.RTF: docColor = docColor || StrCast(Doc.UserDoc().textBackgroundColor, Colors.LIGHT_GRAY); break;
- case DocumentType.LINK: docColor = (isAnchor ? docColor : undefined); break;
case DocumentType.INK: docColor = doc?.stroke_isInkMask ? 'rgba(0,0,0,0.7)' : undefined; break;
case DocumentType.EQUATION: docColor = docColor || StrCast(Doc.UserDoc().textBackgroundColor, 'transparent'); break;
case DocumentType.LABEL: docColor = docColor || Colors.LIGHT_GRAY; break;
case DocumentType.BUTTON: docColor = docColor || Colors.LIGHT_GRAY; break;
+ case DocumentType.LINK: docColor = docColor || docColorFn('backgroundColor'); break;
case DocumentType.IMG:
case DocumentType.WEB:
case DocumentType.PDF: