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 Feb 25, 2022
1 parent 68fc140 commit d9fffa4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 49 deletions.
59 changes: 27 additions & 32 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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 @@ -138,38 +137,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
37 changes: 20 additions & 17 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
* 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 @@ -57,23 +58,25 @@ 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 />
{ children }
<GlobalStylesProvider>
<UnsavedChangesWarning />
<InterfaceSkeleton
drawer={
<NavigationSidebar
isDefaultOpen={ isNavigationDefaultOpen }
activeTemplateType={ activeTemplateType }
/>
}
notices={ <EditorSnackbars /> }
shortcuts={ {
previous: previousShortcut,
next: nextShortcut,
} }
{ ...props }
/>
<Popover.Slot />
{ children }
</GlobalStylesProvider>
</EntityProvider>
</SlotFillProvider>
</ShortcutProvider>
Expand Down

0 comments on commit d9fffa4

Please sign in to comment.