From b2c16f3c684098a8dabff3911c610caa5c053701 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 20 Feb 2023 15:37:48 +0000 Subject: [PATCH] Fix: OffCanvasEditor does not inserts submenu on collapsed items. (#48214) --- .../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 a3829998361bc0..d79f71638cbdf8 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(); } } >