From 21802dcf1b0bab0471da7532330b251d95bbda1a Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 15 Feb 2023 09:43:45 +0100 Subject: [PATCH] Simplification --- .../src/components/global-styles/hooks.js | 55 +++++-------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/packages/block-editor/src/components/global-styles/hooks.js b/packages/block-editor/src/components/global-styles/hooks.js index afc357f7f5e10..b843b978bbd4b 100644 --- a/packages/block-editor/src/components/global-styles/hooks.js +++ b/packages/block-editor/src/components/global-styles/hooks.js @@ -246,47 +246,20 @@ export function overrideSettingsWithSupports( settings, supports ) { }; } - if ( ! supports.includes( 'lineHeight' ) ) { - updatedSettings.typography = { - ...updatedSettings.typography, - lineHeight: false, - }; - } - - if ( ! supports.includes( 'fontStyle' ) ) { - updatedSettings.typography = { - ...updatedSettings.typography, - fontStyle: false, - }; - } - - if ( ! supports.includes( 'fontWeight' ) ) { - updatedSettings.typography = { - ...updatedSettings.typography, - fontWeight: false, - }; - } - - if ( ! supports.includes( 'letterSpacing' ) ) { - updatedSettings.typography = { - ...updatedSettings.typography, - letterSpacing: false, - }; - } - - if ( ! supports.includes( 'textTransform' ) ) { - updatedSettings.typography = { - ...updatedSettings.typography, - textTransform: false, - }; - } - - if ( ! supports.includes( 'textDecoration' ) ) { - updatedSettings.typography = { - ...updatedSettings.typography, - textDecoration: false, - }; - } + [ + 'lineHeight', + 'fontStyle', + 'fontWeight', + 'letterSpacing', + 'textTransform', + ].forEach( ( key ) => { + if ( ! supports.includes( key ) ) { + updatedSettings.typography = { + ...updatedSettings.typography, + [ key ]: false, + }; + } + } ); return updatedSettings; }