diff --git a/packages/edit-site/src/components/sidebar-edit-mode/page-panels/hooks.js b/packages/edit-site/src/components/sidebar-edit-mode/page-panels/hooks.js index c76f8da1a4c0b0..d30e0d80cfe081 100644 --- a/packages/edit-site/src/components/sidebar-edit-mode/page-panels/hooks.js +++ b/packages/edit-site/src/components/sidebar-edit-mode/page-panels/hooks.js @@ -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; - } ), + ) + ), } ) ) ); } diff --git a/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js b/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js index 2cdafac4f4306c..bf9be3ab1a639a 100644 --- a/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js +++ b/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js @@ -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();