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

Keep meta boxes in the interface content’s scrolling context for device previews #66726

Closed
Closed
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,16 @@ function Layout( {
hasHistory,
isWelcomeGuideVisible,
templateId,
isDevicePreview,
} = useSelect(
( select ) => {
const { get } = select( preferencesStore );
const { isFeatureActive, getEditedPostTemplateId } = unlock(
select( editPostStore )
);
const { canUser, getPostType } = select( coreStore );
const { getDeviceType, getEditorMode, getRenderingMode } =
select( editorStore );

const supportsTemplateMode = settings.supportsTemplateMode;
const isViewable =
Expand All @@ -434,7 +437,7 @@ function Layout( {
} );

return {
mode: select( editorStore ).getEditorMode(),
mode: getEditorMode(),
isFullscreenActive:
select( editPostStore ).isFeatureActive( 'fullscreenMode' ),
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
Expand All @@ -444,7 +447,7 @@ function Layout( {
isDistractionFree: get( 'core', 'distractionFree' ),
showMetaBoxes:
! DESIGN_POST_TYPES.includes( currentPostType ) &&
select( editorStore ).getRenderingMode() === 'post-only',
getRenderingMode() === 'post-only',
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
templateId:
supportsTemplateMode &&
Expand All @@ -453,6 +456,7 @@ function Layout( {
! isEditingTemplate
? getEditedPostTemplateId()
: null,
isDevicePreview: getDeviceType() !== 'Desktop',
};
},
[ currentPostType, isEditingTemplate, settings.supportsTemplateMode ]
Expand Down Expand Up @@ -594,7 +598,11 @@ function Layout( {
extraContent={
! isDistractionFree &&
showMetaBoxes && (
<MetaBoxesMain isLegacy={ ! shouldIframe } />
<MetaBoxesMain
isLegacy={
! shouldIframe || isDevicePreview
}
/>
)
}
>
Expand Down
13 changes: 8 additions & 5 deletions packages/edit-post/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@
clear: both;
}

.has-metaboxes .editor-visual-editor {
flex: 1;
// Only when the split view is active the visual editor should allow shrinking and
// its main size should be zero.
.has-metaboxes .interface-interface-skeleton__content:has(.edit-post-meta-boxes-main) .editor-visual-editor {
flex-shrink: 1;
flex-basis: 0%;
}

&.is-iframed {
isolation: isolate;
}
.has-metaboxes .editor-visual-editor.is-iframed {
isolation: isolate;
}

// Adjust the position of the notices
Expand Down
Loading