Skip to content

Commit

Permalink
rename dfm to distractionFreeMode
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Aug 30, 2023
1 parent a2b4c3c commit b21ee24
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/edit-site/src/store/actions.js
Expand Up @@ -376,10 +376,10 @@ export function updateSettings( settings ) {
export const setIsListViewOpened =
( isOpen ) =>
( { dispatch, registry } ) => {
const dfmMode = registry
const distractionFreeMode = registry
.select( preferencesStore )
.get( 'core/edit-site', 'distractionFree' );
if ( dfmMode && isOpen ) {
if ( distractionFreeMode && isOpen ) {
dispatch.toggleDistractionFree();
}
dispatch( {
Expand Down Expand Up @@ -542,10 +542,10 @@ export const revertTemplate =
export const openGeneralSidebar =
( name ) =>
( { dispatch, registry } ) => {
const dfmMode = registry
const distractionFreeMode = registry
.select( preferencesStore )
.get( 'core/edit-site', 'distractionFree' );
if ( dfmMode ) {
if ( distractionFreeMode ) {
dispatch.toggleDistractionFree();
}
registry
Expand Down Expand Up @@ -579,10 +579,10 @@ export const switchEditorMode =
if ( mode === 'visual' ) {
speak( __( 'Visual editor selected' ), 'assertive' );
} else if ( mode === 'text' ) {
const dfmMode = registry
const distractionFreeMode = registry
.select( preferencesStore )
.get( 'core/edit-site', 'distractionFree' );
if ( dfmMode ) {
if ( distractionFreeMode ) {
dispatch.toggleDistractionFree();
}
speak( __( 'Code editor selected' ), 'assertive' );
Expand Down Expand Up @@ -616,10 +616,10 @@ export const setHasPageContentFocus =
export const toggleDistractionFree =
() =>
( { dispatch, registry } ) => {
const dfmMode = registry
const distractionFreeMode = registry
.select( preferencesStore )
.get( 'core/edit-site', 'distractionFree' );
if ( ! dfmMode ) {
if ( ! distractionFreeMode ) {
registry.batch( () => {
registry
.dispatch( preferencesStore )
Expand All @@ -632,11 +632,15 @@ export const toggleDistractionFree =
registry.batch( () => {
registry
.dispatch( preferencesStore )
.set( 'core/edit-site', 'distractionFree', ! dfmMode );
.set(
'core/edit-site',
'distractionFree',
! distractionFreeMode
);
registry
.dispatch( noticesStore )
.createInfoNotice(
dfmMode
distractionFreeMode
? __( 'Distraction free off.' )
: __( 'Distraction free on.' ),
{
Expand Down

0 comments on commit b21ee24

Please sign in to comment.