@@ -80,7 +80,7 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
8080 const [ typographySettings , setTypographySettings ] = useState ( [ ] )
8181 const [ applySettingsTo , setApplySettingsTo ] = useState ( '' )
8282 const [ customFontPairs , setCustomFontPairs ] = useState ( [ ] )
83- const [ selectedFontPairName , setSelectedFontPairName ] = useState ( 'theme-heading-default/theme-body-default ' )
83+ const [ selectedFontPairName , setSelectedFontPairName ] = useState ( '' )
8484 const [ editingFontPairName , setEditingFontPairName ] = useState ( '' )
8585
8686 const fontPairContainerRef = useRef ( null )
@@ -187,7 +187,7 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
187187 const resetStyles = selector => {
188188 let newSettings
189189 const currentFontPair = [ ...FONT_PAIRS , ...customFontPairs ] . find ( fontPair => fontPair . name === selectedFontPairName )
190- if ( ! editingFontPairName ) {
190+ if ( ! editingFontPairName && currentFontPair ) {
191191 newSettings = { ...typographySettings , [ selector ] : currentFontPair . typography [ selector ] }
192192 } else {
193193 newSettings = omit ( typographySettings , [ selector ] )
@@ -211,9 +211,9 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
211211
212212 const getIsAllowReset = selector => {
213213 const currentFontPair = [ ...FONT_PAIRS , ...customFontPairs ] . find ( fontPair => fontPair . name === selectedFontPairName )
214- const fontPairStyle = currentFontPair . typography [ selector ]
215214 const typographyStyle = typographySettings [ selector ]
216- if ( ! editingFontPairName ) {
215+ if ( ! editingFontPairName && currentFontPair ) {
216+ const fontPairStyle = currentFontPair . typography [ selector ]
217217 if ( ! isEqual ( fontPairStyle , typographyStyle ) ) {
218218 return true
219219 }
0 commit comments