Skip to content

Commit 4055b89

Browse files
fixed theme styling
1 parent 7bd15c6 commit 4055b89

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

client/packages/lowcoder/src/comps/utils/themeUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function setInitialCompStyles({
4141
styleKeys.forEach(styleKey => {
4242
actions[styleKey] = changeValueAction({
4343
...(compTheme?.[styleKey] as object || {}),
44-
...styleProps[styleKey],
44+
// ...styleProps[styleKey],
4545
}, true);
4646
})
4747

client/packages/lowcoder/src/util/hooks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,14 @@ export function useMergeCompStyles(
172172
props: Record<string, any>,
173173
dispatch: (action: CompAction) => void
174174
) {
175+
const editorState = useContext(EditorContext);
175176
const theme = useContext(ThemeContext);
176177
const compType = useContext(CompTypeContext);
177178
const compTheme = theme?.theme?.components?.[compType];
178179
const themeId = theme?.themeId;
180+
const appSettingsComp = editorState?.getAppSettingsComp();
181+
const preventAppStylesOverwriting = appSettingsComp?.getView()?.preventAppStylesOverwriting;
182+
const { preventStyleOverwriting } = props;
179183

180184
const styleKeys = Object.keys(props).filter(key => key.toLowerCase().endsWith('style' || 'styles'));
181185
const styleProps: Record<string, any> = {};
@@ -184,6 +188,7 @@ export function useMergeCompStyles(
184188
});
185189

186190
useEffect(() => {
191+
if (preventAppStylesOverwriting || preventStyleOverwriting) return;
187192
setInitialCompStyles({
188193
dispatch,
189194
compTheme,
@@ -194,6 +199,8 @@ export function useMergeCompStyles(
194199
themeId,
195200
JSON.stringify(styleProps),
196201
JSON.stringify(compTheme),
197-
setInitialCompStyles
202+
setInitialCompStyles,
203+
preventAppStylesOverwriting,
204+
preventStyleOverwriting,
198205
]);
199206
}

0 commit comments

Comments
 (0)