Skip to content

Commit

Permalink
Wipes out theme utils - looks like we don't need them
Browse files Browse the repository at this point in the history
Do all ref and URI resolution in getStylesDeclarations()
  • Loading branch information
ramonjd committed Aug 2, 2024
1 parent b0eaa1a commit ec668b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ import { isBlobURL } from '@wordpress/blob';
/**
* Internal dependencies
*/
import { useToolsPanelDropdownMenuProps, getResolvedRefValue } from './utils';
import { useToolsPanelDropdownMenuProps, getResolvedValue } from './utils';
import { setImmutably } from '../../utils/object';
import MediaReplaceFlow from '../media-replace-flow';
import { store as blockEditorStore } from '../../store';
import { getResolvedThemeFilePath } from './theme-file-uri-utils';

import {
globalStylesDataKey,
globalStylesLinksDataKey,
Expand Down Expand Up @@ -680,7 +680,6 @@ export default function BackgroundPanel( {
defaultControls = DEFAULT_CONTROLS,
defaultValues = {},
headerLabel = __( 'Background image' ),
themeFileURIs,
} ) {
const { globalStyles, _links } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
Expand All @@ -691,8 +690,6 @@ export default function BackgroundPanel( {
};
}, [] );

themeFileURIs = themeFileURIs || _links?.[ 'wp:theme-file' ];

/*
* Resolve any inherited "ref" pointers.
* Should the block editor need inherited values
Expand All @@ -709,26 +706,17 @@ export default function BackgroundPanel( {

Object.entries( inheritedValue?.background ).forEach(
( [ key, backgroundValue ] ) => {
resolvedValues.background[ key ] = getResolvedRefValue(
resolvedValues.background[ key ] = getResolvedValue(
backgroundValue,
{
styles: globalStyles,
_links,
}
);
if (
'backgroundImage' === key &&
resolvedValues.background[ key ]?.url
) {
resolvedValues.background[ key ].url =
getResolvedThemeFilePath(
resolvedValues.background[ key ].url,
themeFileURIs
);
}
}
);
return resolvedValues;
}, [ globalStyles, inheritedValue ] );
}, [ globalStyles, _links, inheritedValue ] );

const resetAllFilter = useCallback( ( previousValue ) => {
return {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit ec668b8

Please sign in to comment.