Skip to content

Commit

Permalink
Stop showing limited global styles notice in editor distraction free …
Browse files Browse the repository at this point in the history
…mode (#40907)

* Stop showing limited global styles notice in editor distraction free mode

Fixes #40906

* changelog

* Alter logic to remove the notice in distraction free mode
  • Loading branch information
adamwoodnz authored Jan 9, 2025
1 parent f7f7c16 commit 42a62f9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Global Styles: Stop showing the limited global styles notice in distraction free mode.
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Global Styles: Stop showing the limited global styles notice in distraction free mode.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Global Styles: Stop showing the limited global styles notice in distraction free mode.

0 comments on commit 42a62f9

Please sign in to comment.