Skip to content

Commit

Permalink
Navigation Focus Mode: Remove leftover code (#61897)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>
  • Loading branch information
3 people committed May 24, 2024
1 parent cbf29f6 commit 9922d6a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 43 deletions.
35 changes: 2 additions & 33 deletions packages/edit-site/src/components/block-editor/editor-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import { store as blockEditorStore } from '@wordpress/block-editor';
import { useSelect, useDispatch } from '@wordpress/data';
import { ENTER, SPACE } from '@wordpress/keycodes';
import { useState, useEffect, useMemo } from '@wordpress/element';
Expand All @@ -21,32 +20,15 @@ import {
*/
import { unlock } from '../../lock-unlock';
import { store as editSiteStore } from '../../store';
import {
FOCUSABLE_ENTITIES,
NAVIGATION_POST_TYPE,
} from '../../utils/constants';

const { EditorCanvas: EditorCanvasRoot } = unlock( editorPrivateApis );

function EditorCanvas( { settings, children } ) {
const {
hasBlocks,
isFocusMode,
templateType,
canvasMode,
currentPostIsTrashed,
} = useSelect( ( select ) => {
const { getBlockCount } = select( blockEditorStore );
const { getEditedPostType, getCanvasMode } = unlock(
select( editSiteStore )
);
const _templateType = getEditedPostType();
const { canvasMode, currentPostIsTrashed } = useSelect( ( select ) => {
const { getCanvasMode } = unlock( select( editSiteStore ) );

return {
templateType: _templateType,
isFocusMode: FOCUSABLE_ENTITIES.includes( _templateType ),
canvasMode: getCanvasMode(),
hasBlocks: !! getBlockCount(),
currentPostIsTrashed:
select( editorStore ).getCurrentPostAttribute( 'status' ) ===
'trash',
Expand Down Expand Up @@ -92,15 +74,6 @@ function EditorCanvas( { settings, children } ) {
},
readonly: true,
};
const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
const isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;
// Hide the appender when:
// - In navigation focus mode (should only allow the root Nav block).
// - In view mode (i.e. not editing).
const showBlockAppender =
( isNavigationFocusMode && hasBlocks ) || canvasMode === 'view'
? false
: undefined;

const styles = useMemo(
() => [
Expand All @@ -123,10 +96,6 @@ function EditorCanvas( { settings, children } ) {

return (
<EditorCanvasRoot
className={ clsx( 'edit-site-editor-canvas__block-list', {
'is-navigation-block': isTemplateTypeNavigation,
} ) }
renderAppender={ showBlockAppender }
styles={ styles }
iframeProps={ {
className: clsx( 'edit-site-visual-editor__editor-canvas', {
Expand Down
6 changes: 0 additions & 6 deletions packages/edit-site/src/components/block-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
}
}

// Navigation focus mode requires padding around the root Navigation block
// for presentational purposes.
.edit-site-editor-canvas__block-list.is-navigation-block {
padding: $grid-unit-30;
}

.edit-site-visual-editor {
position: relative;
height: 100%;
Expand Down
4 changes: 0 additions & 4 deletions packages/editor/src/components/editor-canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ function checkForPostContentAtRootLevel( blocks ) {
function EditorCanvas( {
// Ideally as we unify post and site editors, we won't need these props.
autoFocus,
className,
renderAppender,
styles,
disableIframe = false,
iframeProps,
Expand Down Expand Up @@ -454,7 +452,6 @@ function EditorCanvas( {
>
<BlockList
className={ clsx(
className,
'is-' + deviceType.toLowerCase() + '-preview',
renderingMode !== 'post-only' ||
isDesignPostType
Expand All @@ -469,7 +466,6 @@ function EditorCanvas( {
? localRef.current
: localRef.current?.parentNode
}
renderAppender={ renderAppender }
__unstableDisableDropZone={
// In template preview mode, disable drop zones at the root of the template.
renderingMode === 'template-locked'
Expand Down

0 comments on commit 9922d6a

Please sign in to comment.