From 47cb65eac96c0237bf2edaefb7ea00722af54a85 Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 20 Feb 2024 14:13:06 +1100 Subject: [PATCH] Forgot that useSettings won't accept top level paths --- packages/block-editor/src/hooks/font-size.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/block-editor/src/hooks/font-size.js b/packages/block-editor/src/hooks/font-size.js index 9f3e278a69c40..e0f8c47c163b0 100644 --- a/packages/block-editor/src/hooks/font-size.js +++ b/packages/block-editor/src/hooks/font-size.js @@ -21,10 +21,7 @@ import { shouldSkipSerialization, } from './utils'; import { useSettings } from '../components/use-settings'; -import { - getTypographyFontSizeValue, - getFluidTypographyOptionsFromSettings, -} from '../components/global-styles/typography-utils'; +import { getTypographyFontSizeValue } from '../components/global-styles/typography-utils'; export const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize'; @@ -151,8 +148,9 @@ export function useIsFontSizeDisabled( { name: blockName } = {} ) { } function useBlockProps( { name, fontSize, style } ) { - const [ typography, layout ] = useSettings( - 'typography', + const [ fontSizes, fluidTypographySettings, layoutSettings ] = useSettings( + 'typography.fontSizes', + 'typography.fluid', 'layout' ); @@ -176,7 +174,12 @@ function useBlockProps( { name, fontSize, style } ) { style: { fontSize: getTypographyFontSizeValue( { size: style.typography.fontSize }, - { typography, layout } + { + typography: { + fluid: fluidTypographySettings, + }, + layout: layoutSettings, + } ), }, }; @@ -186,7 +189,7 @@ function useBlockProps( { name, fontSize, style } ) { props = { style: { fontSize: getFontSize( - typography?.fontSizes, + fontSizes, fontSize, style?.typography?.fontSize ).size,