From 521e19c9671cf9d5679258fb9485f259f562f8f9 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sat, 27 Jan 2024 12:47:39 +0900 Subject: [PATCH] Site Editor: Prevent classic theme from accessing global style menu --- packages/edit-site/src/components/sidebar-edit-mode/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-edit-mode/index.js b/packages/edit-site/src/components/sidebar-edit-mode/index.js index edd48ee69d361b..aaeb2fd875df5c 100644 --- a/packages/edit-site/src/components/sidebar-edit-mode/index.js +++ b/packages/edit-site/src/components/sidebar-edit-mode/index.js @@ -8,6 +8,7 @@ import { useEffect } from '@wordpress/element'; import { useSelect, useDispatch } from '@wordpress/data'; import { store as interfaceStore } from '@wordpress/interface'; import { store as blockEditorStore } from '@wordpress/block-editor'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -41,13 +42,13 @@ export function SidebarComplementaryAreaFills() { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE, ].includes( _sidebar ); - const settings = select( editSiteStore ).getSettings(); return { sidebar: _sidebar, isEditorSidebarOpened: _isEditorSidebarOpened, hasBlockSelection: !! select( blockEditorStore ).getBlockSelectionStart(), - supportsGlobalStyles: ! settings?.supportsTemplatePartsMode, + supportsGlobalStyles: + select( coreStore ).getCurrentTheme()?.is_block_theme, isEditingPage: select( editSiteStore ).isPage(), }; }, [] );