Skip to content

Commit

Permalink
Editor: Keep compatibility with current template format.
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Jul 11, 2019
1 parent 22f9ce5 commit 5afab34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/editor/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ export function* setupEditor( post, edits, template ) {

// Apply a template for new posts only, if exists.
if ( template ) {
blocks = synchronizeBlocksWithTemplate( blocks, parse( template.post_content ) );
blocks = synchronizeBlocksWithTemplate(
blocks,
template.post_content ? parse( template.post_content ) : template
);
}

yield resetPost( post );
Expand Down Expand Up @@ -480,7 +483,7 @@ export function* savePost( options = {} ) {
);

const template = ( yield select( STORE_KEY, 'getEditorSettings' ) ).template;
if ( template ) {
if ( template && template.post_content ) {
yield apiFetch( {
path: `/wp/v2/${ template.post_type }/${ template.ID }`,
method: 'PUT',
Expand Down

0 comments on commit 5afab34

Please sign in to comment.