Skip to content

Commit

Permalink
Revert "Revert "Stop showing limited global styles notice in editor d…
Browse files Browse the repository at this point in the history
…istracti…"

This reverts commit ecdb13d.
  • Loading branch information
adamwoodnz authored Jan 16, 2025
1 parent be0d34b commit 4eba920
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4eba920

Please sign in to comment.