Skip to content

Commit

Permalink
Fix: OffCanvasEditor does not inserts submenu on collapsed items.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Feb 17, 2023
1 parent 0b5ca22 commit a062253
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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 );

Expand Down Expand Up @@ -74,6 +76,9 @@ function AddSubmenuItem( { block, onClose } ) {
updateSelectionOnInsert
);
}
if ( ! expandedState[ block.clientId ] ) {
expand( block.clientId );
}
onClose();
} }
>
Expand Down

0 comments on commit a062253

Please sign in to comment.