From 97f9b66b4b2fe56e725376f8ada4f546a75e57f2 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 20 Jan 2022 13:51:55 +1100 Subject: [PATCH] Site Editor: Restore ?stlyes=open functionality (#38093) Restore functionality that opens the Styles panel when ?styles=open is passed a URL query param. --- packages/edit-site/src/components/editor/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index 1a5e2a6dcaa32..440e9a4fa51e5 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -105,6 +105,7 @@ function Editor( { onError } ) { }; }, [] ); const { setPage, setIsInserterOpened } = useDispatch( editSiteStore ); + const { enableComplementaryArea } = useDispatch( interfaceStore ); const [ isEntitiesSavedStatesOpen, @@ -147,6 +148,19 @@ function Editor( { onError } ) { } }, [ isNavigationOpen ] ); + useEffect( + function openGlobalStylesOnLoad() { + const searchParams = new URLSearchParams( window.location.search ); + if ( searchParams.get( 'styles' ) === 'open' ) { + enableComplementaryArea( + 'core/edit-site', + 'edit-site/global-styles' + ); + } + }, + [ enableComplementaryArea ] + ); + // Don't render the Editor until the settings are set and loaded const isReady = settings?.siteUrl &&