diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js b/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js
index 8160c4ffe38b1..4b2a3b82566fb 100644
--- a/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js
+++ b/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js
@@ -68,6 +68,10 @@ export function useFocusFirstElement( clientId ) {
return;
}
+ if ( ! ref.current ) {
+ return;
+ }
+
const { ownerDocument } = ref.current;
// Focus is captured by the wrapper node, so while focus transition
diff --git a/packages/block-editor/src/hooks/align.js b/packages/block-editor/src/hooks/align.js
index d2bf0b2b428b8..82ce1a2dd9ed0 100644
--- a/packages/block-editor/src/hooks/align.js
+++ b/packages/block-editor/src/hooks/align.js
@@ -14,13 +14,11 @@ import {
getBlockType,
hasBlockSupport,
} from '@wordpress/blocks';
-import { useSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import { BlockControls, BlockAlignmentControl } from '../components';
-import { store as blockEditorStore } from '../store';
import useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';
/**
@@ -166,10 +164,6 @@ export const withDataAlign = createHigherOrderComponent(
( BlockListBlock ) => ( props ) => {
const { name, attributes } = props;
const { align } = attributes;
- const hasWideEnabled = useSelect(
- ( select ) => !! select( blockEditorStore ).getSettings().alignWide,
- []
- );
// If an alignment is not assigned, there's no need to go through the
// effort to validate or assign its value.
@@ -179,8 +173,7 @@ export const withDataAlign = createHigherOrderComponent(
const validAlignments = getValidAlignments(
getBlockSupport( name, 'align' ),
- hasBlockSupport( name, 'alignWide', true ),
- hasWideEnabled
+ hasBlockSupport( name, 'alignWide', true )
);
let wrapperProps = props.wrapperProps;
diff --git a/packages/block-library/src/template-part/edit/index.js b/packages/block-library/src/template-part/edit/index.js
index fb5e5adc431a9..57341222e594a 100644
--- a/packages/block-library/src/template-part/edit/index.js
+++ b/packages/block-library/src/template-part/edit/index.js
@@ -114,51 +114,57 @@ export default function TemplatePartEdit( {
isEntityAvailable={ isEntityAvailable }
templatePartId={ templatePartId }
/>
-
- { isPlaceholder && (
+ { isPlaceholder && (
+
- ) }
- { isEntityAvailable && (
-
-
- (
-
- { __( 'Replace' ) }
-
- ) }
- renderContent={ ( { onClose } ) => (
-
- ) }
- />
-
-
- ) }
- { isEntityAvailable && (
- 0 }
- layout={ layout }
- />
- ) }
- { ! isPlaceholder && ! isResolved && }
-
+
+ ) }
+ { isEntityAvailable && (
+
+
+ (
+
+ { __( 'Replace' ) }
+
+ ) }
+ renderContent={ ( { onClose } ) => (
+
+ ) }
+ />
+
+
+ ) }
+ { isEntityAvailable && (
+ 0 }
+ layout={ layout }
+ />
+ ) }
+ { ! isPlaceholder && ! isResolved && (
+
+
+
+ ) }
);
}
diff --git a/packages/block-library/src/template-part/edit/inner-blocks.js b/packages/block-library/src/template-part/edit/inner-blocks.js
index b00c64e61a4a6..6ac67ee109faa 100644
--- a/packages/block-library/src/template-part/edit/inner-blocks.js
+++ b/packages/block-library/src/template-part/edit/inner-blocks.js
@@ -14,6 +14,8 @@ export default function TemplatePartInnerBlocks( {
postId: id,
hasInnerBlocks,
layout,
+ tagName: TagName,
+ blockProps,
} ) {
const themeSupportsLayout = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
@@ -31,21 +33,18 @@ export default function TemplatePartInnerBlocks( {
'wp_template_part',
{ id }
);
- const innerBlocksProps = useInnerBlocksProps(
- {},
- {
- value: blocks,
- onInput,
- onChange,
- renderAppender: hasInnerBlocks
- ? undefined
- : InnerBlocks.ButtonBlockAppender,
- __experimentalLayout: {
- type: 'default',
- // Find a way to inject this in the support flag code (hooks).
- alignments: themeSupportsLayout ? alignments : undefined,
- },
- }
- );
- return ;
+ const innerBlocksProps = useInnerBlocksProps( blockProps, {
+ value: blocks,
+ onInput,
+ onChange,
+ renderAppender: hasInnerBlocks
+ ? undefined
+ : InnerBlocks.ButtonBlockAppender,
+ __experimentalLayout: {
+ type: 'default',
+ // Find a way to inject this in the support flag code (hooks).
+ alignments: themeSupportsLayout ? alignments : undefined,
+ },
+ } );
+ return ;
}