@@ -172,10 +172,14 @@ export function useMergeCompStyles(
172
172
props : Record < string , any > ,
173
173
dispatch : ( action : CompAction ) => void
174
174
) {
175
+ const editorState = useContext ( EditorContext ) ;
175
176
const theme = useContext ( ThemeContext ) ;
176
177
const compType = useContext ( CompTypeContext ) ;
177
178
const compTheme = theme ?. theme ?. components ?. [ compType ] ;
178
179
const themeId = theme ?. themeId ;
180
+ const appSettingsComp = editorState ?. getAppSettingsComp ( ) ;
181
+ const preventAppStylesOverwriting = appSettingsComp ?. getView ( ) ?. preventAppStylesOverwriting ;
182
+ const { preventStyleOverwriting } = props ;
179
183
180
184
const styleKeys = Object . keys ( props ) . filter ( key => key . toLowerCase ( ) . endsWith ( 'style' || 'styles' ) ) ;
181
185
const styleProps : Record < string , any > = { } ;
@@ -184,6 +188,7 @@ export function useMergeCompStyles(
184
188
} ) ;
185
189
186
190
useEffect ( ( ) => {
191
+ if ( preventAppStylesOverwriting || preventStyleOverwriting ) return ;
187
192
setInitialCompStyles ( {
188
193
dispatch,
189
194
compTheme,
@@ -194,6 +199,8 @@ export function useMergeCompStyles(
194
199
themeId ,
195
200
JSON . stringify ( styleProps ) ,
196
201
JSON . stringify ( compTheme ) ,
197
- setInitialCompStyles
202
+ setInitialCompStyles ,
203
+ preventAppStylesOverwriting ,
204
+ preventStyleOverwriting ,
198
205
] ) ;
199
206
}
0 commit comments