Skip to content

Commit

Permalink
Site Editor: Restore ?stlyes=open functionality (#38093)
Browse files Browse the repository at this point in the history
Restore functionality that opens the Styles panel when ?styles=open is
passed a URL query param.
  • Loading branch information
noisysocks committed Jan 20, 2022
1 parent a010546 commit b1acbba
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/edit-site/src/components/editor/index.js
Expand Up @@ -105,6 +105,7 @@ function Editor( { onError } ) {
};
}, [] );
const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
const { enableComplementaryArea } = useDispatch( interfaceStore );

const [
isEntitiesSavedStatesOpen,
Expand Down Expand Up @@ -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 &&
Expand Down

0 comments on commit b1acbba

Please sign in to comment.