Skip to content

Commit

Permalink
fix(template-modal): prevent modal closing after autosave
Browse files Browse the repository at this point in the history
closes #45
  • Loading branch information
adekbadek committed Apr 17, 2020
1 parent e9c4630 commit 12965c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const NewsletterEdit = ( {
getBlocks,
insertBlocks,
replaceBlocks,
isEditedPostNew,
isEditedPostEmpty,
savePost,
} ) => {
const templates =
Expand All @@ -70,7 +70,7 @@ const NewsletterEdit = ( {
};

const isDisplayingTemplateModal =
isEditedPostNew && templates && templates.length && insertedTemplate === null;
isEditedPostEmpty && templates && templates.length && insertedTemplate === null;

return isDisplayingTemplateModal ? (
<TemplateModal
Expand All @@ -94,10 +94,10 @@ const NewsletterEdit = ( {

const NewsletterEditWithSelect = compose( [
withSelect( select => {
const { isEditedPostNew } = select( 'core/editor' );
const { isEditedPostEmpty } = select( 'core/editor' );
const { getBlocks } = select( 'core/block-editor' );
return {
isEditedPostNew: isEditedPostNew(),
isEditedPostEmpty: isEditedPostEmpty(),
getBlocks,
};
} ),
Expand Down

0 comments on commit 12965c4

Please sign in to comment.