From 09c1249c59ca1a9c13703b88e99079ed279dde5d Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 20 Nov 2024 14:36:24 +0100 Subject: [PATCH 1/2] Site Editor: Unify layout with posts dataviews --- .../edit-site/src/components/app/index.js | 19 ++++--------------- .../edit-site/src/components/layout/index.js | 14 ++++++++++++-- .../src/components/posts-app/index.js | 14 +++----------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/packages/edit-site/src/components/app/index.js b/packages/edit-site/src/components/app/index.js index 3588565fcb3c1..7e4c50d7d00f0 100644 --- a/packages/edit-site/src/components/app/index.js +++ b/packages/edit-site/src/components/app/index.js @@ -1,11 +1,6 @@ /** * WordPress dependencies */ -import { SlotFillProvider } from '@wordpress/components'; -import { - UnsavedChangesWarning, - privateApis as editorPrivateApis, -} from '@wordpress/editor'; import { store as noticesStore } from '@wordpress/notices'; import { useDispatch } from '@wordpress/data'; import { __, sprintf } from '@wordpress/i18n'; @@ -23,7 +18,6 @@ import useSetCommandContext from '../../hooks/commands/use-set-command-context'; import { useRegisterSiteEditorRoutes } from '../site-editor-routes'; const { RouterProvider } = unlock( routerPrivateApis ); -const { GlobalStylesProvider } = unlock( editorPrivateApis ); function AppLayout() { useCommonCommands(); @@ -50,14 +44,9 @@ export default function App() { } return ( - - - - - - - - - + + + + ); } diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index cbc0a4661bf3e..96e3af119599b 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -23,6 +23,7 @@ import { CommandMenu } from '@wordpress/commands'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; import { EditorSnackbars, + UnsavedChangesWarning, privateApis as editorPrivateApis, } from '@wordpress/editor'; import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands'; @@ -44,12 +45,12 @@ import SavePanel from '../save-panel'; const { useCommands } = unlock( coreCommandsPrivateApis ); const { useGlobalStyle } = unlock( blockEditorPrivateApis ); -const { NavigableRegion } = unlock( editorPrivateApis ); +const { NavigableRegion, GlobalStylesProvider } = unlock( editorPrivateApis ); const { useLocation } = unlock( routerPrivateApis ); const ANIMATION_DURATION = 0.3; -export default function Layout( { route } ) { +function Layout( { route } ) { const { params } = useLocation(); const { canvas = 'view' } = params; useCommands(); @@ -78,6 +79,7 @@ export default function Layout( { route } ) { return ( <> + { canvas === 'view' && }
); } + +export default function LayoutWithGlobalStylesProvider( props ) { + return ( + + + + ); +} diff --git a/packages/edit-site/src/components/posts-app/index.js b/packages/edit-site/src/components/posts-app/index.js index 80d2c1c7eba86..dda25802e0d34 100644 --- a/packages/edit-site/src/components/posts-app/index.js +++ b/packages/edit-site/src/components/posts-app/index.js @@ -1,10 +1,6 @@ /** * WordPress dependencies */ -import { - UnsavedChangesWarning, - privateApis as editorPrivateApis, -} from '@wordpress/editor'; import { privateApis as routerPrivateApis } from '@wordpress/router'; /** @@ -15,7 +11,6 @@ import useActiveRoute from './router'; import { unlock } from '../../lock-unlock'; const { RouterProvider } = unlock( routerPrivateApis ); -const { GlobalStylesProvider } = unlock( editorPrivateApis ); function PostsLayout() { const route = useActiveRoute(); @@ -24,11 +19,8 @@ function PostsLayout() { export default function PostsApp() { return ( - - - - - - + + + ); } From 478e094d5f09a4b7c75b1ef376d575a16d441e93 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 27 Nov 2024 11:48:36 +0100 Subject: [PATCH 2/2] Try restore SlotFillProvider --- packages/edit-site/src/components/layout/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index 96e3af119599b..47ff65aa2ac67 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -10,6 +10,7 @@ import { __unstableMotion as motion, __unstableAnimatePresence as AnimatePresence, __unstableUseNavigateRegions as useNavigateRegions, + SlotFillProvider, } from '@wordpress/components'; import { useReducedMotion, @@ -236,8 +237,10 @@ function Layout( { route } ) { export default function LayoutWithGlobalStylesProvider( props ) { return ( - - - + + + + + ); }