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

BlockCanvas: Fix the height prop and width of the block editor #65977

Merged
merged 1 commit into from
Oct 9, 2024
Merged
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
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 @@ -2,25 +2,6 @@
position: relative;
}

.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);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved these tiles to style.scss instead of content.scss because AFAIK these apply to elements that are rendered outside of the iframe.


.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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where was this border coming from that it has to be reset here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The browser default for iframes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, maybe a tiny comment would help.

} }
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
Loading