Skip to content

Commit

Permalink
Refactor globals css in site editor now custom css in editor settings
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Dec 5, 2022
1 parent 7a64ac0 commit d312776
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { PRESET_METADATA, ROOT_BLOCK_SELECTOR, scopeSelector } from './utils';
import { getTypographyFontSizeValue } from './typography-utils';
import { GlobalStylesContext } from './context';
import { useSetting, useStyle } from './hooks';
import { useSetting } from './hooks';

// List of block support features that can have their related styles
// generated under their own feature level selector rather than the block's.
Expand Down Expand Up @@ -792,6 +792,10 @@ export const toStyles = (
}
} );

if ( tree?.styles?.css ) {
ruleset = ruleset + tree.styles.css;
}

return ruleset;
};

Expand Down Expand Up @@ -885,7 +889,6 @@ export function useGlobalStylesOutput() {
let { merged: mergedConfig } = useContext( GlobalStylesContext );

const [ blockGap ] = useSetting( 'spacing.blockGap' );
const [ customCSS ] = useStyle( 'css' );
const hasBlockGapSupport = blockGap !== null;
const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
const disableLayoutStyles = useSelect( ( select ) => {
Expand Down Expand Up @@ -920,10 +923,6 @@ export function useGlobalStylesOutput() {
css: globalStyles,
isGlobalStyles: true,
},
{
css: customCSS ?? '',
isGlobalStyles: true,
},
];

return [ stylesheets, mergedConfig.settings, filters ];
Expand All @@ -932,6 +931,5 @@ export function useGlobalStylesOutput() {
hasFallbackGapSupport,
mergedConfig,
disableLayoutStyles,
customCSS,
] );
}

0 comments on commit d312776

Please sign in to comment.