Skip to content
Prev Previous commit
Next Next commit
Disable the Cancel button, too
  • Loading branch information
ockham committed Jul 5, 2021
commit 50e896f2a19c2e321ba57c744b2f38cb8c6fab17
9 changes: 8 additions & 1 deletion packages/editor/src/components/post-publish-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class PostPublishPanel extends Component {
isPublishSidebarEnabled,
isScheduled,
isSaving,
isSavingNonPostEntityChanges,
onClose,
onTogglePublishSidebar,
PostPublishExtension,
Expand Down Expand Up @@ -97,7 +98,11 @@ export class PostPublishPanel extends Component {
/>
</div>
<div className="editor-post-publish-panel__header-cancel-button">
<Button onClick={ onClose } variant="secondary">
<Button
disabled={ isSavingNonPostEntityChanges }
onClick={ onClose }
variant="secondary"
>
{ __( 'Cancel' ) }
</Button>
</div>
Expand Down Expand Up @@ -140,6 +145,7 @@ export default compose( [
isEditedPostBeingScheduled,
isEditedPostDirty,
isSavingPost,
isSavingNonPostEntityChanges,
} = select( editorStore );
const { isPublishSidebarEnabled } = select( editorStore );
const postType = getPostType( getEditedPostAttribute( 'type' ) );
Expand All @@ -156,6 +162,7 @@ export default compose( [
isPublished: isCurrentPostPublished(),
isPublishSidebarEnabled: isPublishSidebarEnabled(),
isSaving: isSavingPost(),
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
isScheduled: isCurrentPostScheduled(),
};
} ),
Expand Down