Skip to content

Commit

Permalink
Editor: Update data selector in 'PostPreviewButton' (WordPress#68678)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: dhananjaykuber <[email protected]>
  • 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

0 comments on commit 5a5455c

Please sign in to comment.