Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distraction Free Keyboard Shortcut: Fix notices in site editor #52867

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading