From 362f5ae73ebf1b36cb80b956388b091edd80d294 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Thu, 12 May 2022 14:17:03 +0200 Subject: [PATCH 1/6] Show the inserter if the template part is empty --- packages/edit-site/src/components/block-editor/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index 29f22a64a548d6..3388ef2f0f1705 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -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 = () => ( @@ -186,7 +187,9 @@ export default function BlockEditor( { setIsInserterOpen } ) { <__unstableBlockSettingsMenuFirstItem> From 0061085207e7cc444d96375bc59ed111937daab0 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Thu, 12 May 2022 14:43:13 +0200 Subject: [PATCH 2/6] Update index.js --- packages/edit-site/src/components/block-editor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index 3388ef2f0f1705..4ec7b95ca6103a 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -112,7 +112,7 @@ export default function BlockEditor( { setIsInserterOpen } ) { const { clearSelectedBlock } = useDispatch( blockEditorStore ); const isTemplatePart = templateType === 'wp_template_part'; - const hasBlocks = blocks.length === 0; + const hasBlocks = blocks.length !== 0; const NavMenuSidebarToggle = () => ( From 67a6f2dc7d299bd21ea6d9bd262d6d8cc67eea58 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 13 May 2022 08:17:29 +0200 Subject: [PATCH 3/6] Use the button block appender --- packages/edit-site/src/components/block-editor/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index 4ec7b95ca6103a..82c4768cd5836e 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -21,6 +21,7 @@ import { BlockEditorKeyboardShortcuts, store as blockEditorStore, __unstableBlockNameContext, + InnerBlocks, } from '@wordpress/block-editor'; import { useMergeRefs, useViewportMatch } from '@wordpress/compose'; import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks'; @@ -188,7 +189,9 @@ export default function BlockEditor( { setIsInserterOpen } ) { className="edit-site-block-editor__block-list wp-site-blocks" __experimentalLayout={ LAYOUT } renderAppender={ - isTemplatePart && hasBlocks ? false : undefined + isTemplatePart && hasBlocks + ? false + : InnerBlocks.ButtonBlockAppender } /> From 786294ce19c5c485bb617feb2db11008dd61121a Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Sun, 15 May 2022 11:19:38 +0200 Subject: [PATCH 4/6] Revert to the default appender --- packages/edit-site/src/components/block-editor/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index 82c4768cd5836e..4ec7b95ca6103a 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -21,7 +21,6 @@ import { BlockEditorKeyboardShortcuts, store as blockEditorStore, __unstableBlockNameContext, - InnerBlocks, } from '@wordpress/block-editor'; import { useMergeRefs, useViewportMatch } from '@wordpress/compose'; import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks'; @@ -189,9 +188,7 @@ export default function BlockEditor( { setIsInserterOpen } ) { className="edit-site-block-editor__block-list wp-site-blocks" __experimentalLayout={ LAYOUT } renderAppender={ - isTemplatePart && hasBlocks - ? false - : InnerBlocks.ButtonBlockAppender + isTemplatePart && hasBlocks ? false : undefined } /> From f044764162bc5cdfdd6682c7dff87264e0e5471e Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Sun, 15 May 2022 11:35:55 +0200 Subject: [PATCH 5/6] Unset the visual editor height while in focus mode --- packages/edit-site/src/components/block-editor/style.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/edit-site/src/components/block-editor/style.scss b/packages/edit-site/src/components/block-editor/style.scss index 9830f1e302eac0..401cbc5e2874c5 100644 --- a/packages/edit-site/src/components/block-editor/style.scss +++ b/packages/edit-site/src/components/block-editor/style.scss @@ -30,6 +30,8 @@ .components-resizable-box__container { overflow: visible; } + // Remove the 100% height. + height: unset; } .components-resizable-box__container { From 4d8d576282a51bcf9245675e6d96759a02f1bac7 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Sun, 15 May 2022 12:12:33 +0200 Subject: [PATCH 6/6] Revert CSS change --- packages/edit-site/src/components/block-editor/style.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/edit-site/src/components/block-editor/style.scss b/packages/edit-site/src/components/block-editor/style.scss index 401cbc5e2874c5..9830f1e302eac0 100644 --- a/packages/edit-site/src/components/block-editor/style.scss +++ b/packages/edit-site/src/components/block-editor/style.scss @@ -30,8 +30,6 @@ .components-resizable-box__container { overflow: visible; } - // Remove the 100% height. - height: unset; } .components-resizable-box__container {