Skip to content

Commit

Permalink
Editor: Unify the content area of the post and site editors (WordPres…
Browse files Browse the repository at this point in the history
…s#61860)

Co-authored-by: youknowriad <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
  • Loading branch information
3 people authored and carstingaxion committed Jun 4, 2024
1 parent a3f902e commit c7432c9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
10 changes: 3 additions & 7 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
UnsavedChangesWarning,
EditorNotices,
EditorKeyboardShortcutsRegister,
EditorKeyboardShortcuts,
EditorSnackbars,
store as editorStore,
privateApis as editorPrivateApis,
Expand All @@ -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';
Expand Down Expand Up @@ -335,7 +333,6 @@ function Layout( { initialPost } ) {
<LocalAutosaveMonitor />
<EditPostKeyboardShortcuts />
<EditorKeyboardShortcutsRegister />
<EditorKeyboardShortcuts />
<BlockKeyboardShortcuts />

<InterfaceSkeleton
Expand Down Expand Up @@ -367,7 +364,9 @@ function Layout( { initialPost } ) {
{ ( mode === 'text' || ! isRichEditingEnabled ) && (
<TextEditor />
) }
{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }
{ ! isLargeViewport && mode === 'visual' && (
<BlockToolbar hideDragHandle />
) }
{ isRichEditingEnabled && mode === 'visual' && (
<VisualEditor styles={ styles } />
) }
Expand All @@ -377,9 +376,6 @@ function Layout( { initialPost } ) {
<MetaBoxes location="advanced" />
</div>
) }
{ isMobileViewport && sidebarIsOpened && (
<ScrollLock />
) }
</>
}
footer={
Expand Down
32 changes: 14 additions & 18 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
} from '@wordpress/block-editor';
import {
EditorKeyboardShortcutsRegister,
EditorKeyboardShortcuts,
EditorNotices,
privateApis as editorPrivateApis,
store as editorStore,
Expand Down Expand Up @@ -265,6 +264,15 @@ export default function Editor( { isLoading, onClick } ) {

return (
<>
<GlobalStylesRenderer />
<EditorKeyboardShortcutsRegister />
{ isEditMode && <BlockKeyboardShortcuts /> }
{ showVisualEditor && (
<>
<TemplatePartConverter />
<PatternModal />
</>
) }
{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }
{ isEditMode && <WelcomeGuide /> }
{ hasLoadedPost && ! editedPost && (
Expand Down Expand Up @@ -342,27 +350,15 @@ export default function Editor( { isLoading, onClick } ) {
}
content={
<>
<GlobalStylesRenderer />
{ isEditMode && <EditorNotices /> }
{ showVisualEditor && (
<>
<TemplatePartConverter />
{ ! isLargeViewport && (
<BlockToolbar hideDragHandle />
) }
<SiteEditorCanvas onClick={ onClick } />
<PatternModal />
</>
) }
{ editorMode === 'text' && isEditMode && (
<CodeEditor />
) }
{ isEditMode && (
<>
<EditorKeyboardShortcutsRegister />
<EditorKeyboardShortcuts />
<BlockKeyboardShortcuts />
</>
{ ! isLargeViewport && showVisualEditor && (
<BlockToolbar hideDragHandle />
) }
{ showVisualEditor && (
<SiteEditorCanvas onClick={ onClick } />
) }
</>
}
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -273,6 +274,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(
{ type === 'wp_navigation' && (
<NavigationBlockEditingMode />
) }
<EditorKeyboardShortcuts />
<KeyboardShortcutHelpModal />
<BlockRemovalWarnings />
<StartPageOptions />
Expand Down

0 comments on commit c7432c9

Please sign in to comment.