diff --git a/projects/packages/jetpack-mu-wpcom/changelog/revert-40907-fix-global-styles-notice-distraction-free b/projects/packages/jetpack-mu-wpcom/changelog/revert-40907-fix-global-styles-notice-distraction-free deleted file mode 100644 index ac22518a55b54..0000000000000 --- a/projects/packages/jetpack-mu-wpcom/changelog/revert-40907-fix-global-styles-notice-distraction-free +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: removed - -Global Styles: Revert changes that hide notice in distraction free mode diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/notices.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/notices.js index 16cd184be1ac0..c0d9ca64467dc 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/notices.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/notices.js @@ -1,5 +1,6 @@ /* global wpcomGlobalStyles */ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +import { store as blockEditorStore } from '@wordpress/block-editor'; import { ExternalLink, Notice } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; import { @@ -238,19 +239,31 @@ function GlobalStylesEditNotice() { upgradePlan, ] ); + const isDistractionFree = useSelect( + select => select( blockEditorStore ).getSettings().isDistractionFree, + [] + ); + useEffect( () => { if ( ! isSiteEditor && ! isPostEditor ) { return; } - if ( globalStylesInUse ) { + if ( globalStylesInUse && ! isDistractionFree ) { showNotice(); } else { removeNotice( NOTICE_ID ); } return () => removeNotice( NOTICE_ID ); - }, [ globalStylesInUse, isSiteEditor, isPostEditor, removeNotice, showNotice ] ); + }, [ + globalStylesInUse, + isDistractionFree, + isSiteEditor, + isPostEditor, + removeNotice, + showNotice, + ] ); return null; }