Skip to content

Commit

Permalink
Template editor: Show the inserter if the template part is empty (#41024
Browse files Browse the repository at this point in the history
)

* Show the inserter if the template part is empty

* Update index.js

* Use the button block appender

* Revert to the default appender

* Unset the visual editor height while in focus mode

* Revert CSS change
  • Loading branch information
carolinan committed May 17, 2022
1 parent 3803777 commit b8ee22a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/edit-site/src/components/block-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default function BlockEditor( { setIsInserterOpen } ) {
const { clearSelectedBlock } = useDispatch( blockEditorStore );

const isTemplatePart = templateType === 'wp_template_part';
const hasBlocks = blocks.length !== 0;

const NavMenuSidebarToggle = () => (
<ToolbarGroup>
Expand Down Expand Up @@ -186,7 +187,9 @@ export default function BlockEditor( { setIsInserterOpen } ) {
<BlockList
className="edit-site-block-editor__block-list wp-site-blocks"
__experimentalLayout={ LAYOUT }
renderAppender={ isTemplatePart ? false : undefined }
renderAppender={
isTemplatePart && hasBlocks ? false : undefined
}
/>
</ResizableEditor>
<__unstableBlockSettingsMenuFirstItem>
Expand Down

0 comments on commit b8ee22a

Please sign in to comment.