From 1662b7ba265add1082288ebcb71f5aa957fc09a3 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 1 Aug 2023 17:38:01 +1200 Subject: [PATCH] Fix color and behavior of unsynced patterns in block inserter (#53205) --- .../components/inserter-list-item/index.js | 4 +++- .../inserter/hooks/use-block-types-state.js | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/components/inserter-list-item/index.js b/packages/block-editor/src/components/inserter-list-item/index.js index 43510cdd52d96..dc755e8767623 100644 --- a/packages/block-editor/src/components/inserter-list-item/index.js +++ b/packages/block-editor/src/components/inserter-list-item/index.js @@ -49,7 +49,9 @@ function InserterListItem( { ]; }, [ item.name, item.initialAttributes, item.initialAttributes ] ); - const isSynced = isReusableBlock( item ) || isTemplatePart( item ); + const isSynced = + ( isReusableBlock( item ) && item.syncStatus !== 'unsynced' ) || + isTemplatePart( item ); return ( { ); const onSelectItem = useCallback( - ( { name, initialAttributes, innerBlocks }, shouldFocusBlock ) => { - const insertedBlock = createBlock( - name, - initialAttributes, - createBlocksFromInnerBlocksTemplate( innerBlocks ) - ); + ( + { name, initialAttributes, innerBlocks, syncStatus, content }, + shouldFocusBlock + ) => { + const insertedBlock = + syncStatus === 'unsynced' + ? parse( content, { + __unstableSkipMigrationLogs: true, + } ) + : createBlock( + name, + initialAttributes, + createBlocksFromInnerBlocksTemplate( innerBlocks ) + ); onInsert( insertedBlock, undefined, shouldFocusBlock ); },