diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js index b02c662de0df3b..4c207f3dab8ea3 100644 --- a/packages/block-editor/src/hooks/style.js +++ b/packages/block-editor/src/hooks/style.js @@ -83,10 +83,12 @@ export function getInlineStyles( styles = {} ) { if ( !! subPaths && ! isString( styleValue ) ) { Object.entries( subPaths ).forEach( ( entry ) => { - const [ name, suffix ] = entry; - output[ name ] = compileStyleValue( - get( styleValue, [ suffix ] ) - ); + const [ name, subPath ] = entry; + const value = get( styleValue, [ subPath ] ); + + if ( value ) { + output[ name ] = compileStyleValue( value ); + } } ); } else { output[ propKey ] = compileStyleValue( get( styles, path ) );