Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Editor: Restore ?styles=open functionality #38093

Merged
merged 1 commit into from Jan 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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