Skip to content

Commit

Permalink
Allow reading base theme global styles in all instances
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Sep 12, 2024
1 parent 55122fb commit 41276bb
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions packages/editor/src/components/global-styles-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { useMemo, useCallback } from '@wordpress/element';
* Internal dependencies
*/
import { unlock } from '../../lock-unlock';
import { store as editorStore } from '../../store';

const { GlobalStylesContext, cleanEmptyObject } = unlock(
blockEditorPrivateApis
Expand Down Expand Up @@ -169,20 +168,11 @@ function useGlobalStylesUserConfig() {
}

function useGlobalStylesBaseConfig() {
const baseConfig = useSelect( ( select ) => {
const {
__experimentalGetCurrentThemeBaseGlobalStyles,
getCurrentTheme,
canUser,
} = select( coreStore );
const currentTheme = getCurrentTheme();

return currentTheme &&
canUser( 'read', 'global-styles/themes', currentTheme.stylesheet )
? __experimentalGetCurrentThemeBaseGlobalStyles()
: undefined;
}, [] );

const baseConfig = useSelect(
( select ) =>
select( coreStore ).__experimentalGetCurrentThemeBaseGlobalStyles(),
[]
);
return [ !! baseConfig, baseConfig ];
}

Expand Down

0 comments on commit 41276bb

Please sign in to comment.