From 5a5455cb6f7633ececc00559b7a407b42f4874d6 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 15 Jan 2025 13:41:25 +0400 Subject: [PATCH] Editor: Update data selector in 'PostPreviewButton' (#68678) Co-authored-by: Mamaduka Co-authored-by: t-hamano Co-authored-by: im3dabasia Co-authored-by: dhananjaykuber --- packages/editor/src/components/post-preview-button/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-preview-button/index.js b/packages/editor/src/components/post-preview-button/index.js index d1755f96b68615..0429ce691b4f17 100644 --- a/packages/editor/src/components/post-preview-button/index.js +++ b/packages/editor/src/components/post-preview-button/index.js @@ -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, }; }, [] );