Skip to content

Commit

Permalink
Editor: Update data selector in 'PostPreviewButton' (#68678)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>
  • Loading branch information
5 people authored Jan 15, 2025
1 parent 4085555 commit 5a5455c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/editor/src/components/post-preview-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,17 @@ export default function PostPreviewButton( {
const postType = core.getPostType(
editor.getCurrentPostType( 'type' )
);
const canView = postType?.viewable ?? false;
if ( ! canView ) {
return { isViewable: canView };
}

return {
postId: editor.getCurrentPostId(),
currentPostLink: editor.getCurrentPostAttribute( 'link' ),
previewLink: editor.getEditedPostPreviewLink(),
isSaveable: editor.isEditedPostSaveable(),
isViewable: postType?.viewable ?? false,
isViewable: canView,
};
}, [] );

Expand Down

1 comment on commit 5a5455c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 5a5455c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12785561373
📝 Reported issues:

Please sign in to comment.