-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 Mode: Don't show the metaboxes #48947
Changes from 1 commit
4ac5156
bf8b15a
77ab658
b60e3fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ function Layout( { styles } ) { | |
isInserterOpened, | ||
isListViewOpened, | ||
showIconLabels, | ||
isDistractionFreeMode, | ||
isDistractionFree, | ||
showBlockBreadcrumbs, | ||
isTemplateMode, | ||
documentLabel, | ||
|
@@ -116,7 +116,7 @@ function Layout( { styles } ) { | |
).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ), | ||
showIconLabels: | ||
select( editPostStore ).isFeatureActive( 'showIconLabels' ), | ||
isDistractionFreeMode: | ||
isDistractionFree: | ||
select( editPostStore ).isFeatureActive( 'distractionFree' ), | ||
showBlockBreadcrumbs: select( editPostStore ).isFeatureActive( | ||
'showBlockBreadcrumbs' | ||
|
@@ -126,8 +126,6 @@ function Layout( { styles } ) { | |
}; | ||
}, [] ); | ||
|
||
const isDistractionFree = isDistractionFreeMode && isLargeViewport; | ||
|
||
const openSidebarPanel = () => | ||
openGeneralSidebar( | ||
hasBlockSelected ? 'edit-post/block' : 'edit-post/document' | ||
|
@@ -164,7 +162,7 @@ function Layout( { styles } ) { | |
'has-fixed-toolbar': hasFixedToolbar, | ||
'has-metaboxes': hasActiveMetaboxes, | ||
'show-icon-labels': showIconLabels, | ||
'is-distraction-free': isDistractionFree, | ||
'is-distraction-free': isDistractionFree && isLargeViewport, | ||
'is-entity-save-view-open': !! entitiesSavedStatesCallback, | ||
} ); | ||
|
||
|
@@ -206,7 +204,7 @@ function Layout( { styles } ) { | |
<EditorKeyboardShortcutsRegister /> | ||
<SettingsSidebar /> | ||
<InterfaceSkeleton | ||
isDistractionFree={ isDistractionFree } | ||
isDistractionFree={ isDistractionFree && isLargeViewport } | ||
className={ className } | ||
labels={ { | ||
...interfaceLabels, | ||
|
@@ -245,14 +243,16 @@ function Layout( { styles } ) { | |
notices={ <EditorSnackbars /> } | ||
content={ | ||
<> | ||
{ ! isDistractionFree && <EditorNotices /> } | ||
{ ( ! isDistractionFree || ! isLargeViewport ) && ( | ||
<EditorNotices /> | ||
) } | ||
{ ( mode === 'text' || ! isRichEditingEnabled ) && ( | ||
<TextEditor /> | ||
) } | ||
{ isRichEditingEnabled && mode === 'visual' && ( | ||
<VisualEditor styles={ styles } /> | ||
) } | ||
{ ! isTemplateMode && ( | ||
{ ! isDistractionFree && ! isTemplateMode && ( | ||
<div className="edit-post-layout__metaboxes"> | ||
<MetaBoxes location="normal" /> | ||
<MetaBoxes location="advanced" /> | ||
|
@@ -265,8 +265,8 @@ function Layout( { styles } ) { | |
} | ||
footer={ | ||
! isDistractionFree && | ||
showBlockBreadcrumbs && | ||
! isMobileViewport && | ||
showBlockBreadcrumbs && | ||
isRichEditingEnabled && | ||
mode === 'visual' && ( | ||
Comment on lines
265
to
269
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing appears to have changed here, but the This fixes another problem. In trunk, there is a "gap" in the viewport width generated by this conditional statement, so the breadcrumb list is displayed when the viewport width is between 782px and 960px, even in distraction-free mode, as shown below. 87835d47b037b1cc67e9e3bfdcc5f478.mp4 |
||
<div className="edit-post-layout__footer"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fix another issue? Because it doesn't match
isDistractionFreeMode && isLargeViewport
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the original condition is rewritten as is, it will be
! ( isDistractionFree && isLargeViewport )
.Isn't this the same as
( ! isDistractionFree || ! isLargeViewport )
? 🤔 Personally, I think this writing style is easier to read.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we only want to hide the notices in "distraction-free" mode. We can remove the
! isLargeViewport
part.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your're right, I have confirmed that removing that section will produce the same expected results as before.
In addition, I have made the following changes in 77ab658 to address the following issues:
This should completely hide the notice message in distraction-free mode.
This comment was marked as duplicate.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we address those issues separately. Let's just fix the metabox issue in this PR.