Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
More cleanup
  • Loading branch information
youknowriad committed Oct 27, 2025
commit 4466b0f6aea604a241d9abee26933362b914be65
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import {
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { useContext } from '@wordpress/element';

/**
* Internal dependencies
*/
import useStylesForBlocks from '../block-styles/use-styles-for-block';
import { replaceActiveStyle } from '../block-styles/utils';
import { store as blockEditorStore } from '../../store';
import { GlobalStylesContext } from '../global-styles';
import { globalStylesDataKey } from '../../store/private-keys';
import { getVariationStylesWithRefValues } from '../../hooks/block-style-variation';

Expand Down Expand Up @@ -47,7 +45,6 @@ function SwitchSectionStyle( { clientId } ) {
const { updateBlockAttributes } = useDispatch( blockEditorStore );

// Get global styles data
const { merged: mergedConfig } = useContext( GlobalStylesContext );
const { globalSettings, globalStyles, blockName } = useSelect(
( select ) => {
const settings = select( blockEditorStore ).getSettings();
Expand All @@ -64,8 +61,8 @@ function SwitchSectionStyle( { clientId } ) {
const activeStyleBackground = activeStyle?.name
? getVariationStylesWithRefValues(
{
settings: mergedConfig?.settings ?? globalSettings,
styles: mergedConfig?.styles ?? globalStyles,
settings: globalSettings,
styles: globalStyles,
},
blockName,
activeStyle.name
Expand Down
16 changes: 0 additions & 16 deletions packages/block-editor/src/components/global-styles/context.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export { useSettingsForBlockElement } from './hooks';
export { GlobalStylesContext } from './context';
export {
default as TypographyPanel,
useHasTypographyPanel,
Expand Down
22 changes: 5 additions & 17 deletions packages/block-editor/src/hooks/block-style-variation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
*/
import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
import { useSelect } from '@wordpress/data';
import { useContext, useMemo } from '@wordpress/element';
import { useMemo } from '@wordpress/element';
import { toStyles, getBlockSelectors } from '@wordpress/global-styles-engine';

/**
* Internal dependencies
*/
import { GlobalStylesContext } from '../components/global-styles';
import { usePrivateStyleOverride } from './utils';
import { getValueFromObjectPath } from '../utils/object';
import { store as blockEditorStore } from '../store';
Expand Down Expand Up @@ -249,10 +248,6 @@ export function getVariationStylesWithRefValues(
}

function useBlockStyleVariation( name, variation, clientId ) {
// Prefer global styles data in GlobalStylesContext, which are available
// if in the site editor. Otherwise fall back to whatever is in the
// editor settings and available in the post editor.
const { merged: mergedConfig } = useContext( GlobalStylesContext );
const { globalSettings, globalStyles } = useSelect( ( select ) => {
const settings = select( blockEditorStore ).getSettings();
return {
Expand All @@ -264,15 +259,15 @@ function useBlockStyleVariation( name, variation, clientId ) {
return useMemo( () => {
const variationStyles = getVariationStylesWithRefValues(
{
settings: mergedConfig?.settings ?? globalSettings,
styles: mergedConfig?.styles ?? globalStyles,
settings: globalSettings,
styles: globalStyles,
},
name,
variation
);

return {
settings: mergedConfig?.settings ?? globalSettings,
settings: globalSettings,
// The variation style data is all that is needed to generate
// the styles for the current application to a block. The variation
// name is updated to match the instance specific class name.
Expand All @@ -286,14 +281,7 @@ function useBlockStyleVariation( name, variation, clientId ) {
},
},
};
}, [
mergedConfig,
globalSettings,
globalStyles,
variation,
clientId,
name,
] );
}, [ globalSettings, globalStyles, variation, clientId, name ] );
}

// Rather than leveraging `useInstanceId` here, the `clientId` is used.
Expand Down
Loading