diff --git a/editor/components/post-preview-button/index.js b/editor/components/post-preview-button/index.js index d0ad6111bf6636..bda9f811babb4f 100644 --- a/editor/components/post-preview-button/index.js +++ b/editor/components/post-preview-button/index.js @@ -50,12 +50,19 @@ export class PostPreviewButton extends Component { } saveForPreview( event ) { - const { isDirty, isNew } = this.props; + const { previewLink, isDirty, isNew } = this.props; + // Let default link behavior occur if no changes to saved post if ( ! isDirty && ! isNew ) { return; } + // Likewise, if a preview URL is available and already assigned as + // the href of the clicked link, there's no need for the interstitial. + if ( previewLink && event.target.href === previewLink ) { + return; + } + // Save post prior to opening window this.props.autosave(); @@ -100,13 +107,13 @@ export class PostPreviewButton extends Component { } render() { - const { currentPostLink, isSaveable } = this.props; + const { previewLink, currentPostLink, isSaveable } = this.props; return (