From 2e97c9560a62d0d0620f83bba62b81157f7b9be9 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Wed, 11 Sep 2024 08:55:55 -0700 Subject: [PATCH 1/5] Split view with meta boxes with non-iframed canvas --- .../edit-post/src/components/layout/index.js | 23 ++++--------------- .../src/components/layout/style.scss | 16 +++++++++++-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index b50e17054fd3e..c893d257420dd 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -148,11 +148,7 @@ function useEditorStyles( ...additionalStyles ) { ] ); } -/** - * @param {Object} props - * @param {boolean} props.isLegacy True when the editor canvas is not in an iframe. - */ -function MetaBoxesMain( { isLegacy } ) { +function MetaBoxesMain() { const [ isOpen, openHeight, hasAnyVisible ] = useSelect( ( select ) => { const { get } = select( preferencesStore ); const { isMetaBoxLocationVisible } = select( editPostStore ); @@ -232,22 +228,15 @@ function MetaBoxesMain( { isLegacy } ) { const contents = ( ); - if ( isLegacy ) { - return contents; - } - const isAutoHeight = openHeight === undefined; let usedMax = '50%'; // Approximation before max has a value. if ( max !== undefined ) { @@ -580,9 +569,7 @@ function Layout( { } extraContent={ ! isDistractionFree && - showMetaBoxes && ( - - ) + showMetaBoxes && } > diff --git a/packages/edit-post/src/components/layout/style.scss b/packages/edit-post/src/components/layout/style.scss index 18f12c1dbfbb9..4f1d7f8d68eeb 100644 --- a/packages/edit-post/src/components/layout/style.scss +++ b/packages/edit-post/src/components/layout/style.scss @@ -108,9 +108,21 @@ .has-metaboxes .editor-visual-editor { flex: 1; + isolation: isolate; + + &:not(.is-iframed) { + overflow: hidden; - &.is-iframed { - isolation: isolate; + .editor-resizable-editor { + height: auto !important; // TODO: double-check this isn’t problematic or whether it can be obviated with code change to visual-editor. + display: flex; + flex-direction: column; + } + + .editor-resizable-editor > * { + flex: 1 1 100%; + overflow: auto; + } } } From dfe6935b888f560c2143f5a05ce60445133580f9 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Sat, 2 Nov 2024 16:53:33 -0700 Subject: [PATCH 2/5] Fix scrolling of device previews --- .../src/components/block-canvas/index.js | 18 ++++++++++----- .../src/components/block-canvas/style.scss | 22 +++++++++++++++++++ .../src/components/layout/style.scss | 11 ---------- .../src/components/visual-editor/index.js | 1 + 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/packages/block-editor/src/components/block-canvas/index.js b/packages/block-editor/src/components/block-canvas/index.js index c399f38054ed4..ef70c4a26d14e 100644 --- a/packages/block-editor/src/components/block-canvas/index.js +++ b/packages/block-editor/src/components/block-canvas/index.js @@ -1,3 +1,8 @@ +/** + * External dependencies + */ +import clsx from 'clsx'; + /** * WordPress dependencies */ @@ -33,6 +38,7 @@ export function ExperimentalBlockCanvas( { styles, contentRef: contentRefProp, iframeProps, + enableScroll, } ) { useBlockCommands(); const isTabletViewport = useViewportMatch( 'medium', '<' ); @@ -51,12 +57,17 @@ export function ExperimentalBlockCanvas( { frameSize: '40px', } : {}; + const className = clsx( + 'block-editor-block-canvas', + enableScroll && 'is-scrollable' + ); if ( ! shouldIframe ) { return ( { children } @@ -81,6 +88,7 @@ export function ExperimentalBlockCanvas( { return (