Skip to content

Commit

Permalink
Fix canvas height
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 23, 2024
1 parent a26614e commit 73a253d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.block-editor-iframe__body {
position: relative;
}

.block-editor-iframe__container {
width: 100%;
height: 100%;
Expand Down
18 changes: 14 additions & 4 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import { usePaddingAppender } from './use-padding-appender';
const { EditorCanvas } = unlock( editorPrivateApis );

const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
const DESIGN_POST_TYPES = [
'wp_template',
'wp_template_part',
'wp_block',
'wp_navigation',
];

export default function VisualEditor( { styles } ) {
const {
Expand All @@ -34,22 +40,25 @@ export default function VisualEditor( { styles } ) {
hasV3BlocksOnly,
isEditingTemplate,
isZoomedOutView,
postType,
} = useSelect( ( select ) => {
const { isFeatureActive } = select( editPostStore );
const { getEditorSettings, getRenderingMode } = select( editorStore );
const { getEditorSettings, getRenderingMode, getCurrentPostType } =
select( editorStore );
const { getBlockTypes } = select( blocksStore );
const { __unstableGetEditorMode } = select( blockEditorStore );
const editorSettings = getEditorSettings();
const _postType = getCurrentPostType();
return {
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
renderingMode: getRenderingMode(),
isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,
hasV3BlocksOnly: getBlockTypes().every( ( type ) => {
return type.apiVersion >= 3;
} ),
isEditingTemplate:
select( editorStore ).getCurrentPostType() === 'wp_template',
isEditingTemplate: _postType === 'wp_template',
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
postType: _postType,
};
}, [] );
const hasMetaBoxes = useSelect(
Expand All @@ -66,7 +75,8 @@ export default function VisualEditor( { styles } ) {
if (
! isZoomedOutView &&
! hasMetaBoxes &&
renderingMode === 'post-only'
renderingMode === 'post-only' &&
! DESIGN_POST_TYPES.includes( postType )
) {
paddingBottom = '40vh';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function EditorCanvas( { settings, children, onClick } ) {
// Forming a "block formatting context" to prevent margin collapsing.
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context

css: `body{position:relative; ${
css: `body{${
canvasMode === 'view'
? `min-height: 100vh; ${
currentPostIsTrashed ? '' : 'cursor: pointer;'
Expand Down

0 comments on commit 73a253d

Please sign in to comment.