Skip to content

Commit bf2ce55

Browse files
aduthyouknowriad
authored andcommitted
Templates: Always parse blocks from content (#9448)
1 parent 9a25ed1 commit bf2ce55

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/editor/src/store/effects.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,18 @@ export default {
121121
const isNewPost = post.status === 'auto-draft';
122122

123123
// Parse content as blocks
124-
let blocks;
124+
let blocks = parse( post.content.raw );
125125
let isValidTemplate = true;
126-
if ( ! isNewPost ) {
127-
blocks = parse( post.content.raw );
128-
126+
if ( isNewPost && template ) {
127+
// Apply a template for new posts only, if exists.
128+
blocks = synchronizeBlocksWithTemplate( blocks, template );
129+
} else {
129130
// Unlocked templates are considered always valid because they act as default values only.
130131
isValidTemplate = (
131132
! template ||
132133
templateLock !== 'all' ||
133134
doBlocksMatchTemplate( blocks, template )
134135
);
135-
} else if ( template ) {
136-
blocks = synchronizeBlocksWithTemplate( [], template );
137-
} else {
138-
blocks = [];
139136
}
140137

141138
// Include auto draft title in edits while not flagging post as dirty

0 commit comments

Comments
 (0)