Skip to content

Commit

Permalink
Fix support of sticky position in non-iframed post editor
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed Aug 10, 2023
1 parent 1aae9e8 commit 38b48cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 9 additions & 8 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,19 @@ export default function VisualEditor( { styles } ) {
.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}
.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;

const isToBeIframed =
( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&
! hasMetaBoxes ) ||
isTemplateMode ||
deviceType === 'Tablet' ||
deviceType === 'Mobile';

return (
<BlockTools
__unstableContentRef={ ref }
className={ classnames( 'edit-post-visual-editor', {
'is-template-mode': isTemplateMode,
'is-isolated': isToBeIframed,
} ) }
>
<motion.div
Expand All @@ -354,14 +362,7 @@ export default function VisualEditor( { styles } ) {
className={ previewMode }
>
<MaybeIframe
shouldIframe={
( ( hasV3BlocksOnly ||
( isGutenbergPlugin && isBlockBasedTheme ) ) &&
! hasMetaBoxes ) ||
isTemplateMode ||
deviceType === 'Tablet' ||
deviceType === 'Mobile'
}
shouldIframe={ isToBeIframed }
contentRef={ contentRef }
styles={ styles }
>
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-post/src/components/visual-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
position: relative;
display: flex;
flex-flow: column;
overflow: hidden;
&.is-isolated {
overflow: hidden;
}

// Gray preview overlay (desktop/tablet/mobile) is intentionally not set on an element with scrolling content like
// interface-interface-skeleton__content. This causes graphical glitches (flashes of the background color)
Expand Down

0 comments on commit 38b48cc

Please sign in to comment.