From 6a8505d2d93862e8e0681afea74bc32c739eadc3 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 22 May 2024 13:31:11 +0100 Subject: [PATCH] Editor: Unify the content area of the post and site editors --- .../edit-post/src/components/layout/index.js | 10 ++---- .../edit-site/src/components/editor/index.js | 32 ++++++++----------- .../editor/src/components/provider/index.js | 2 ++ 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index 0518f5507d9841..25e74f24577d0e 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -12,7 +12,6 @@ import { UnsavedChangesWarning, EditorNotices, EditorKeyboardShortcutsRegister, - EditorKeyboardShortcuts, EditorSnackbars, store as editorStore, privateApis as editorPrivateApis, @@ -24,7 +23,6 @@ import { privateApis as blockEditorPrivateApis, store as blockEditorStore, } from '@wordpress/block-editor'; -import { ScrollLock } from '@wordpress/components'; import { useViewportMatch } from '@wordpress/compose'; import { PluginArea } from '@wordpress/plugins'; import { __, _x, sprintf } from '@wordpress/i18n'; @@ -335,7 +333,6 @@ function Layout( { initialPost } ) { - ) } - { ! isLargeViewport && } + { ! isLargeViewport && mode === 'visual' && ( + + ) } { isRichEditingEnabled && mode === 'visual' && ( ) } @@ -377,9 +376,6 @@ function Layout( { initialPost } ) { ) } - { isMobileViewport && sidebarIsOpened && ( - - ) } } footer={ diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index c521ea3d8e5c35..2ba3a94f6e704d 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -25,7 +25,6 @@ import { } from '@wordpress/block-editor'; import { EditorKeyboardShortcutsRegister, - EditorKeyboardShortcuts, EditorNotices, privateApis as editorPrivateApis, store as editorStore, @@ -265,6 +264,15 @@ export default function Editor( { isLoading, onClick } ) { return ( <> + + + { isEditMode && } + { showVisualEditor && ( + <> + + + + ) } { ! isReady ? : null } { isEditMode && } { hasLoadedPost && ! editedPost && ( @@ -342,27 +350,15 @@ export default function Editor( { isLoading, onClick } ) { } content={ <> - { isEditMode && } - { showVisualEditor && ( - <> - - { ! isLargeViewport && ( - - ) } - - - - ) } { editorMode === 'text' && isEditMode && ( ) } - { isEditMode && ( - <> - - - - + { ! isLargeViewport && showVisualEditor && ( + + ) } + { showVisualEditor && ( + ) } } diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 93dbb00d8216cc..9830a20f40fad9 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -30,6 +30,7 @@ import StartPageOptions from '../start-page-options'; import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal'; import ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu'; import StartTemplateOptions from '../start-template-options'; +import EditorKeyboardShortcuts from '../global-keyboard-shortcuts'; const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis ); const { PatternsMenuItems } = unlock( editPatternsPrivateApis ); @@ -273,6 +274,7 @@ export const ExperimentalEditorProvider = withRegistryProvider( { type === 'wp_navigation' && ( ) } +