From 39c385e8c807c81f8de1374436184f4d1136d3db Mon Sep 17 00:00:00 2001 From: okmttdhr Date: Fri, 26 May 2023 14:16:20 +0900 Subject: [PATCH 1/2] Hide "View" when previewing a theme --- .../src/components/header-edit-mode/index.js | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/packages/edit-site/src/components/header-edit-mode/index.js b/packages/edit-site/src/components/header-edit-mode/index.js index 0878cb4faae2d..ead04248216c3 100644 --- a/packages/edit-site/src/components/header-edit-mode/index.js +++ b/packages/edit-site/src/components/header-edit-mode/index.js @@ -44,6 +44,7 @@ import { useHasEditorCanvasContainer, } from '../editor-canvas-container'; import { unlock } from '../../private-apis'; +import { isPreviewingTheme } from '../../utils/is-previewing-theme'; const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); @@ -258,37 +259,39 @@ export default function HeaderEditMode() {
- { ! isFocusMode && hasDefaultEditorCanvasView && ( -
- - - - { __( 'View site' ) } - - { - /* translators: accessibility text */ - __( '(opens in a new tab)' ) - } - - - - -
- ) } + + + + { __( 'View site' ) } + + { + /* translators: accessibility text */ + __( '(opens in a new tab)' ) + } + + + + +
+ ) } From dbd6bb1d8bad1e6c0cbea43e4b5c84fe1ef65a1a Mon Sep 17 00:00:00 2001 From: okmttdhr Date: Fri, 26 May 2023 15:36:28 +0900 Subject: [PATCH 2/2] Add a comment --- .../edit-site/src/components/header-edit-mode/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/edit-site/src/components/header-edit-mode/index.js b/packages/edit-site/src/components/header-edit-mode/index.js index ead04248216c3..9b54d1288e54d 100644 --- a/packages/edit-site/src/components/header-edit-mode/index.js +++ b/packages/edit-site/src/components/header-edit-mode/index.js @@ -260,6 +260,14 @@ export default function HeaderEditMode() {
{ ! isFocusMode && + /** + * This isPreviewingTheme() condition can be removed + * once the issues below are fixed + * and previewing the front of the site works well. + * + * https://github.com/WordPress/gutenberg/issues/50713 + * https://github.com/WordPress/gutenberg/issues/50712 + */ ! isPreviewingTheme() && hasDefaultEditorCanvasView && (