Skip to content

Commit

Permalink
Also set the blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian authored and draganescu committed Sep 26, 2023
1 parent b0e1bcf commit 1e835b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ function preparePatterns( patterns, template, currentThemeStylesheet ) {
type: PATTERN_TYPES.theme,
blocks: parse( pattern.content, {
__unstableSkipMigrationLogs: true,
} ).map( ( block ) => {
const injected = injectThemeAttributeInBlockTemplateContent(
} ).map( ( block ) =>
injectThemeAttributeInBlockTemplateContent(
block,
currentThemeStylesheet
);
return injected;
} ),
)
),
} ) )
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export default function ReplaceTemplateButton( {
const onTemplateSelect = async ( selectedTemplate ) => {
//FIXME: This is a hack to get around the fact that the template is not being set correctly.
await setTemplate( null, null );
await entity.edit( { content: selectedTemplate.content } );
await entity.edit( {
blocks: selectedTemplate.blocks,
content: selectedTemplate.content,
} );
await setTemplate( postId, template.slug );
onClose(); // Close the template suggestions modal first.
onClick();
Expand Down

0 comments on commit 1e835b4

Please sign in to comment.