Skip to content

Commit

Permalink
Fix action
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jul 4, 2023
1 parent f4f6288 commit 16dc3b2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
switchToBlockType,
} from '@wordpress/blocks';
import { useState, useMemo } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -17,6 +18,7 @@ import BlockIcon from '../block-icon';
import PreviewBlockPopover from './preview-block-popover';
import BlockVariationTransformations from './block-variation-transformations';
import { useConvertToGroupButtonProps } from '../convert-to-group-buttons';
import { store as blockEditorStore } from '../../store';

/**
* Helper hook to group transformations to display them in a specific order in the UI.
Expand Down Expand Up @@ -73,6 +75,7 @@ const BlockTransformationsMenu = ( {
onSelectVariation,
blocks,
} ) => {
const { replaceBlocks } = useDispatch( blockEditorStore );
const [ hoveredTransformItemName, setHoveredTransformItemName ] =
useState();

Expand Down Expand Up @@ -101,7 +104,13 @@ const BlockTransformationsMenu = ( {
<MenuItem
className={ getBlockMenuDefaultClassName( name ) }
onClick={ () => {
onUngroup();
replaceBlocks(
selectedClientIds,
onUngroup(
firstSelectedBlock.attributes,
firstSelectedBlock.innerBlocks
)
);
} }
>
<BlockIcon icon={ icon } showColors />
Expand Down

0 comments on commit 16dc3b2

Please sign in to comment.