Skip to content

Commit bbe3dca

Browse files
committed
fix: selecting font pair/type scale overwritting previous changes
1 parent 045f6a0 commit bbe3dca

File tree

1 file changed

+7
-0
lines changed
  • src/plugins/global-settings/typography

1 file changed

+7
-0
lines changed

src/plugins/global-settings/typography/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,13 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-typography',
350350
if ( ! selector || typeof styles !== 'object' ) {
351351
return
352352
}
353+
354+
// Merge the new styles with the previous, while overwritting similar styles.
355+
// This allow adding styles without removing the previous ones.
356+
// Check if the object is empty, used for resetting the whole setting.
357+
if ( Object.keys( styles ).length !== 0 ) {
358+
styles = { ...newSettings[ selector ], ...styles }
359+
}
353360
/**
354361
* Delete the object keys with empty strings.
355362
* Otherwise, the API will throw an error code 400

0 commit comments

Comments
 (0)