Skip to content

Commit

Permalink
BlockCanvas: Fix the height prop and width of the block editor (#65977)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: draganescu <andraganescu@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: ajlende <ajlende@git.wordpress.org>
  • Loading branch information
5 people authored and ajlende committed Oct 16, 2024
1 parent 534d751 commit 55c9052
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
19 changes: 0 additions & 19 deletions packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@
border: 0.01px solid transparent;
}

.block-editor-iframe__container {
width: 100%;
height: 100%;
overflow-x: hidden;
}

.block-editor-iframe__scale-container {
width: 100%;
height: 100%;
display: flex;
}

.block-editor-iframe__scale-container.is-zoomed-out {
$container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
$prev-container-width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw);
width: $prev-container-width;
margin-left: calc(-1 * (#{$prev-container-width} - #{$container-width}) / 2);
}

.block-editor-iframe__html {
border: 0 solid $gray-300;
transform-origin: top center;
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ function Iframe( {
style={ {
...props.style,
height: props.style?.height,
border: 0,
} }
ref={ useMergeRefs( [ ref, setRef ] ) }
tabIndex={ tabIndex }
Expand Down
16 changes: 16 additions & 0 deletions packages/block-editor/src/components/iframe/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.block-editor-iframe__container {
width: 100%;
height: 100%;
overflow-x: hidden;
}

.block-editor-iframe__scale-container {
height: 100%;
}

.block-editor-iframe__scale-container.is-zoomed-out {
$container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
$prev-container-width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw);
width: $prev-container-width;
margin-left: calc(-1 * (#{$prev-container-width} - #{$container-width}) / 2);
}
1 change: 1 addition & 0 deletions packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@import "./components/global-styles/style.scss";
@import "./components/grid/style.scss";
@import "./components/height-control/style.scss";
@import "./components/iframe/style.scss";
@import "./components/image-size-control/style.scss";
@import "./components/inserter-list-item/style.scss";
@import "./components/inspector-controls-tabs/style.scss";
Expand Down
2 changes: 1 addition & 1 deletion storybook/stories/playground/box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function EditorBox() {
} }
>
<BlockToolbar hideDragHandle />
<BlockCanvas height="100%" styles={ editorStyles } />
<BlockCanvas height="500px" styles={ editorStyles } />
</BlockEditorProvider>
</div>
);
Expand Down

0 comments on commit 55c9052

Please sign in to comment.