@@ -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