Skip to content

Commit

Permalink
Prevent disabling Preview button when the post is not saveable.
Browse files Browse the repository at this point in the history
This is ripple effect of adding isPostLocked check in `isEditedPostSaveable` selector from e8d6ad0. We can safely remove this check on `Preview` button, because #32341 will prevent any save actions under the hood.
  • Loading branch information
desaiuditd committed Jun 6, 2021
1 parent 677f274 commit de7d5a5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/editor/src/components/post-preview-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class PostPreviewButton extends Component {
}

render() {
const { previewLink, currentPostLink, isSaveable, role } = this.props;
const { previewLink, currentPostLink, role } = this.props;

// Link to the `?preview=true` URL if we have it, since this lets us see
// changes that were autosaved since the post was last published. Otherwise,
Expand All @@ -210,7 +210,6 @@ export class PostPreviewButton extends Component {
className={ classNames }
href={ href }
target={ this.getWindowTarget() }
disabled={ ! isSaveable }
onClick={ this.openPreviewWindow }
ref={ this.buttonRef }
role={ role }
Expand Down Expand Up @@ -239,7 +238,6 @@ export default compose( [
getCurrentPostId,
getCurrentPostAttribute,
getEditedPostAttribute,
isEditedPostSaveable,
isEditedPostAutosaveable,
getEditedPostPreviewLink,
isPostLocked,
Expand All @@ -254,7 +252,6 @@ export default compose( [
currentPostLink: getCurrentPostAttribute( 'link' ),
previewLink:
forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
isSaveable: isEditedPostSaveable(),
isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
isViewable: get( postType, [ 'viewable' ], false ),
isDraft:
Expand Down

0 comments on commit de7d5a5

Please sign in to comment.