Skip to content

Commit

Permalink
Fix GlobalStylesProvider's position
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Mar 1, 2022
1 parent 46d1036 commit 2157324
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 50 deletions.
59 changes: 27 additions & 32 deletions packages/edit-site/src/components/editor/index.js
Expand Up @@ -28,7 +28,6 @@ import ErrorBoundary from '../error-boundary';
import WelcomeGuide from '../welcome-guide';
import { store as editSiteStore } from '../../store';
import { GlobalStylesRenderer } from './global-styles-renderer';
import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
import useTitle from '../routes/use-title';
import Layout from '../layout';
import EditorActions from './actions';
Expand Down Expand Up @@ -137,38 +136,34 @@ function Editor( { onError } ) {
type={ templateType }
id={ entityId }
>
<GlobalStylesProvider>
<BlockContextProvider value={ blockContext }>
<GlobalStylesRenderer />
<ErrorBoundary onError={ onError }>
<KeyboardShortcuts.Register />
<SidebarComplementaryAreaFills />
<EditorNotices />
{ editorMode === 'visual' && template && (
<BlockEditor
setIsInserterOpen={ setIsInserterOpened }
/>
<BlockContextProvider value={ blockContext }>
<GlobalStylesRenderer />
<ErrorBoundary onError={ onError }>
<KeyboardShortcuts.Register />
<SidebarComplementaryAreaFills />
<EditorNotices />
{ editorMode === 'visual' && template && (
<BlockEditor
setIsInserterOpen={ setIsInserterOpened }
/>
) }
{ editorMode === 'text' && template && <CodeEditor /> }
{ templateResolved &&
! template &&
settings?.siteUrl &&
entityId && (
<Notice
status="warning"
isDismissible={ false }
>
{ __(
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
) }
</Notice>
) }
{ editorMode === 'text' && template && (
<CodeEditor />
) }
{ templateResolved &&
! template &&
settings?.siteUrl &&
entityId && (
<Notice
status="warning"
isDismissible={ false }
>
{ __(
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
) }
</Notice>
) }
<KeyboardShortcuts />
</ErrorBoundary>
</BlockContextProvider>
</GlobalStylesProvider>
<KeyboardShortcuts />
</ErrorBoundary>
</BlockContextProvider>
</EntityProvider>
</EntityProvider>
);
Expand Down
39 changes: 21 additions & 18 deletions packages/edit-site/src/components/layout/index.js
Expand Up @@ -19,6 +19,7 @@ import { PluginArea } from '@wordpress/plugins';
* Internal dependencies
*/
import NavigationSidebar from '../navigation-sidebar';
import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
import { store as editSiteStore } from '../../store';

function Layout( {
Expand Down Expand Up @@ -73,24 +74,26 @@ function Layout( {
<ShortcutProvider>
<SlotFillProvider>
<EntityProvider kind="root" type="site">
<UnsavedChangesWarning />
<InterfaceSkeleton
drawer={
<NavigationSidebar
isDefaultOpen={ isNavigationDefaultOpen }
activeTemplateType={ activeTemplateType }
/>
}
notices={ <EditorSnackbars /> }
shortcuts={ {
previous: previousShortcut,
next: nextShortcut,
} }
{ ...props }
/>
<Popover.Slot />
<PluginArea onError={ onPluginAreaError } />
{ children }
<GlobalStylesProvider>
<UnsavedChangesWarning />
<InterfaceSkeleton
drawer={
<NavigationSidebar
isDefaultOpen={ isNavigationDefaultOpen }
activeTemplateType={ activeTemplateType }
/>
}
notices={ <EditorSnackbars /> }
shortcuts={ {
previous: previousShortcut,
next: nextShortcut,
} }
{ ...props }
/>
<Popover.Slot />
<PluginArea onError={ onPluginAreaError } />
{ children }
</GlobalStylesProvider>
</EntityProvider>
</SlotFillProvider>
</ShortcutProvider>
Expand Down

0 comments on commit 2157324

Please sign in to comment.