From 97ac85821c71a62f5d023432d3db169676f30c50 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Tue, 16 Mar 2021 14:50:34 +0100 Subject: [PATCH] Block Editor: Fix the issue with block style preview when example missing --- .../src/components/block-switcher/block-styles-menu.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/components/block-switcher/block-styles-menu.js b/packages/block-editor/src/components/block-switcher/block-styles-menu.js index 497d28ce5d6c51..ad603a9af5cbec 100644 --- a/packages/block-editor/src/components/block-switcher/block-styles-menu.js +++ b/packages/block-editor/src/components/block-switcher/block-styles-menu.js @@ -17,10 +17,8 @@ import { import BlockStyles from '../block-styles'; import PreviewBlockPopover from './preview-block-popover'; -export default function BlockStylesMenu( { - hoveredBlock: { name, clientId }, - onSwitch, -} ) { +export default function BlockStylesMenu( { hoveredBlock, onSwitch } ) { + const { name, clientId } = hoveredBlock; const [ hoveredClassName, setHoveredClassName ] = useState(); const blockType = useSelect( ( select ) => select( blocksStore ).getBlockType( name ), @@ -43,7 +41,7 @@ export default function BlockStylesMenu( { }, innerBlocks: blockType.example.innerBlocks, } ) - : cloneBlock( blockType, { + : cloneBlock( hoveredBlock, { className: hoveredClassName, } ) }