From a0622539f50011643ebd378d1130e491558e8c95 Mon Sep 17 00:00:00 2001 From: Jorge Date: Fri, 17 Feb 2023 16:03:08 +0000 Subject: [PATCH] Fix: OffCanvasEditor does not inserts submenu on collapsed items. --- .../src/components/off-canvas-editor/leaf-more-menu.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js index a3829998361bc..d79f71638cbdf 100644 --- a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js +++ b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js @@ -17,6 +17,7 @@ import { __, sprintf } from '@wordpress/i18n'; */ import { store as blockEditorStore } from '../../store'; import BlockTitle from '../block-title'; +import { useListViewContext } from './context'; const POPOVER_PROPS = { className: 'block-editor-block-settings-menu__popover', @@ -30,6 +31,7 @@ const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = [ ]; function AddSubmenuItem( { block, onClose } ) { + const { expandedState, expand } = useListViewContext(); const { insertBlock, replaceBlock, replaceInnerBlocks } = useDispatch( blockEditorStore ); @@ -74,6 +76,9 @@ function AddSubmenuItem( { block, onClose } ) { updateSelectionOnInsert ); } + if ( ! expandedState[ block.clientId ] ) { + expand( block.clientId ); + } onClose(); } } >