CYS: fix pattern wrapped twice by group blocks (#48712)
* CYS: fix pattern wrapped twice by group blocks * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
2d14a6fb38
commit
2374240bb6
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import { useCallback, useMemo, useRef, useState } from '@wordpress/element';
|
import { useCallback, useMemo, useRef, useState } from '@wordpress/element';
|
||||||
import { useSelect, useDispatch, select } from '@wordpress/data';
|
import { useSelect, useDispatch, select } from '@wordpress/data';
|
||||||
import { cloneBlock } from '@wordpress/blocks';
|
import { BlockInstance, cloneBlock } from '@wordpress/blocks';
|
||||||
import { close } from '@wordpress/icons';
|
import { close } from '@wordpress/icons';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { getNewPath, navigateTo } from '@woocommerce/navigation';
|
import { getNewPath, navigateTo } from '@woocommerce/navigation';
|
||||||
|
@ -68,11 +68,13 @@ export const SidebarPatternScreen = ( { category }: { category: string } ) => {
|
||||||
select( blockEditorStore )
|
select( blockEditorStore )
|
||||||
).__experimentalGetParsedPattern( pattern.name );
|
).__experimentalGetParsedPattern( pattern.name );
|
||||||
|
|
||||||
const clonedParsedPattern = parsedPattern.blocks.map( cloneBlock );
|
const cloneBlocks = parsedPattern.blocks.map(
|
||||||
|
( blockInstance: BlockInstance ) => cloneBlock( blockInstance )
|
||||||
|
);
|
||||||
|
|
||||||
insertBlocks( clonedParsedPattern, insertableIndex );
|
insertBlocks( cloneBlocks, insertableIndex );
|
||||||
|
|
||||||
selectBlock( clonedParsedPattern[ 0 ].clientId, -1 );
|
selectBlock( cloneBlocks.blocks[ 0 ].clientId, -1 );
|
||||||
},
|
},
|
||||||
[ insertBlocks, insertableIndex, selectBlock ]
|
[ insertBlocks, insertableIndex, selectBlock ]
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
CYS: fix pattern wrapped twice by group blocks
|
Loading…
Reference in New Issue