diff --git a/packages/editor/src/components/post-preview-button/index.js b/packages/editor/src/components/post-preview-button/index.js index b455eee290daf..2cdca7d98cfb2 100644 --- a/packages/editor/src/components/post-preview-button/index.js +++ b/packages/editor/src/components/post-preview-button/index.js @@ -165,9 +165,13 @@ export class PostPreviewButton extends Component { // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus this.previewWindow.focus(); - // If we don't need to autosave the post before previewing, then we simply - // load the Preview URL in the Preview tab. - if ( ! this.props.isAutosaveable ) { + if ( + // If we don't need to autosave the post before previewing, then we simply + // load the Preview URL in the Preview tab. + ! this.props.isAutosaveable || + // Do not save or overwrite the post, if the post is already locked. + this.props.isPostLocked + ) { this.setPreviewWindowLink( event.target.href ); return; } @@ -238,6 +242,7 @@ export default compose( [ isEditedPostSaveable, isEditedPostAutosaveable, getEditedPostPreviewLink, + isPostLocked, } = select( editorStore ); const { getPostType } = select( coreStore ); @@ -256,6 +261,7 @@ export default compose( [ [ 'draft', 'auto-draft' ].indexOf( getEditedPostAttribute( 'status' ) ) !== -1, + isPostLocked: isPostLocked(), }; } ), withDispatch( ( dispatch ) => ( {