@@ -101,7 +101,7 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
101101 const { allCustomPresets, useTypographyAsPresets } = useSelect ( select => {
102102 const _customPresetControls = select ( 'stackable/global-preset-controls.custom' ) ?. getCustomPresetControls ( ) ?? { }
103103 const _useTypographyAsPresets = select ( 'stackable/global-preset-controls.custom' ) ?. getUseTypographyAsPresets ( ) ?? false
104- return { allCustomPresets : { ..._customPresetControls } , useTypographyAsPresets : { ... _useTypographyAsPresets } }
104+ return { allCustomPresets : { ..._customPresetControls } , useTypographyAsPresets : _useTypographyAsPresets }
105105 } , [ ] )
106106
107107 const FONT_PAIRS = applyFilters ( 'stackable.global-settings.typography.font-pairs.premium-font-pairs' , FREE_FONT_PAIRS )
@@ -125,10 +125,11 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
125125 } )
126126 } , [ ] )
127127
128- // When typography styles are changed, trigger our editor style generator to update.
129128 useEffect ( ( ) => {
129+ // When typography styles are changed, trigger our editor style generator to update.
130130 doAction ( 'stackable.global-settings.typography.update-trigger' , typographySettings , applySettingsTo )
131131
132+ // Update the custom presets when using typography as presets
132133 if ( useTypographyAsPresets ) {
133134 const fontSizePresets = TYPOGRAPHY_TAGS
134135 . filter ( ( { presetSlug } ) => ! ! presetSlug )
@@ -171,7 +172,7 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
171172
172173 dispatch ( 'stackable/global-preset-controls.custom' ) . updateCustomPresetControls ( newSettings )
173174 }
174- } , [ JSON . stringify ( typographySettings ) , applySettingsTo ] )
175+ } , [ JSON . stringify ( typographySettings ) , applySettingsTo , useTypographyAsPresets ] )
175176
176177 // Scroll to the selected font pair when Global Typography tab is toggled
177178 useEffect ( ( ) => {
0 commit comments