Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions packages/block-editor/src/components/block-list/head.js

This file was deleted.

11 changes: 8 additions & 3 deletions packages/block-editor/src/components/block-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ import { usePreParsePatterns } from '../../utils/pre-parse-patterns';
import { LayoutProvider, defaultLayout } from './layout';
import BlockToolsBackCompat from '../block-tools/back-compat';
import { useBlockSelectionClearer } from '../block-selection-clearer';
import { Head } from './head';

const elementContext = createContext();

export const IntersectionObserver = createContext();

function Root( { className, children } ) {
const [ element, setElement ] = useState();
const isLargeViewport = useViewportMatch( 'medium' );
const { isOutlineMode, isFocusMode, isNavigationMode } = useSelect(
( select ) => {
Expand All @@ -43,12 +45,13 @@ function Root( { className, children } ) {
[]
);
return (
<Head>
<elementContext.Provider value={ element }>
<div
ref={ useMergeRefs( [
useBlockSelectionClearer(),
useBlockDropZone(),
useInBetweenInserter(),
setElement,
] ) }
className={ classnames(
'block-editor-block-list__layout is-root-container',
Expand All @@ -62,7 +65,7 @@ function Root( { className, children } ) {
>
{ children }
</div>
</Head>
</elementContext.Provider>
);
}

Expand All @@ -77,6 +80,8 @@ export default function BlockList( { className, ...props } ) {
);
}

BlockList.__unstableElementContext = elementContext;

function Items( {
placeholder,
rootClientId,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/duotone.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
__experimentalDuotoneControl as DuotoneControl,
useSetting,
} from '../components';
import { Head } from '../components/block-list/head';
import BlockList from '../components/block-list';

const EMPTY_ARRAY = [];

Expand Down Expand Up @@ -242,7 +242,7 @@ const withDuotoneStyles = createHigherOrderComponent(

const className = classnames( props?.className, id );

const element = useContext( Head.context );
const element = useContext( BlockList.__unstableElementContext );

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { store as blockEditorStore } from '../store';
import { InspectorControls } from '../components';
import useSetting from '../components/use-setting';
import { LayoutStyle } from '../components/block-list/layout';
import { Head } from '../components/block-list/head';
import BlockList from '../components/block-list';
import { getLayoutType, getLayoutTypes } from '../layouts';

const layoutBlockSupportKey = '__experimentalLayout';
Expand Down Expand Up @@ -177,7 +177,7 @@ export const withLayoutStyles = createHigherOrderComponent(
},
[ clientId ]
);
const element = useContext( Head.context );
const element = useContext( BlockList.__unstableElementContext );
const shouldRenderLayoutStyles = supportLayout || hasInnerBlocks;
const { layout = {} } = attributes;
const usedLayout = !! layout && layout.inherit ? defaultLayout : layout;
Expand Down