Skip to content

Commit

Permalink
Fix: OffCanvasEditor does not inserts submenu on collapsed items. (#4…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored and ntsekouras committed Feb 21, 2023
1 parent 6786a14 commit 4494f13
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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 @@ -25,6 +26,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 @@ -69,6 +71,9 @@ function AddSubmenuItem( { block, onClose } ) {
updateSelectionOnInsert
);
}
if ( ! expandedState[ block.clientId ] ) {
expand( block.clientId );
}
onClose();
} }
>
Expand Down

0 comments on commit 4494f13

Please sign in to comment.