Skip to content

Commit

Permalink
Distraction Free: Fix notices in site editor (#52867)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong authored and tellthemachines committed Jul 25, 2023
1 parent 04dced7 commit 218ce78
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ function KeyboardShortcutsEditMode() {
);
const { redo, undo } = useDispatch( coreStore );
const {
isFeatureActive,
setIsListViewOpened,
switchEditorMode,
toggleFeature,
setIsInserterOpened,
closeGeneralSidebar,
} = useDispatch( editSiteStore );
Expand All @@ -47,7 +45,8 @@ function KeyboardShortcutsEditMode() {
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
useSelect( blockEditorStore );

const { set: setPreference } = useDispatch( preferencesStore );
const { get: getPreference } = useSelect( preferencesStore );
const { set: setPreference, toggle } = useDispatch( preferencesStore );
const { createInfoNotice } = useDispatch( noticesStore );

const toggleDistractionFree = () => {
Expand Down Expand Up @@ -135,9 +134,9 @@ function KeyboardShortcutsEditMode() {

useShortcut( 'core/edit-site/toggle-distraction-free', () => {
toggleDistractionFree();
toggleFeature( 'distractionFree' );
toggle( 'core/edit-site', 'distractionFree' );
createInfoNotice(
isFeatureActive( 'distractionFree' )
getPreference( 'core/edit-site', 'distractionFree' )
? __( 'Distraction free mode turned on.' )
: __( 'Distraction free mode turned off.' ),
{
Expand Down

0 comments on commit 218ce78

Please sign in to comment.