Skip to content
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
3 changes: 3 additions & 0 deletions packages/block-editor/src/components/block-preview/auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ function AutoBlockPreview( { viewportWidth, __experimentalPadding } ) {
const {
ownerDocument: { documentElement },
} = bodyElement;
documentElement.classList.add(
'block-editor-block-preview__content-iframe'
);
documentElement.style.position = 'absolute';
documentElement.style.width = '100%';
bodyElement.style.padding =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@
}
}
}

// Hide inserter from previews.
.block-editor-block-preview__content-iframe .block-list-appender {
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have a lot of similar styles above, why didn't we just nest this in .block-editor-block-preview__container above? instead of adding this new class?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the fact that we introduced iframes for previews is preventing all these resets from applying, in that case, maybe we should move all these reset styles inside the iframe selector. cc @ellatrix

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'm happy to try a followup here. But from what I can tell, we actually do need both the outer and the inner container. The outer sets things like border, border radius, pointer cursor, all unscaled. The inner is only for content inside the iframe, and as you found, needs to be unscoped.

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we should be able to render a block list in a disabled mode that doesn't render any appenders. I thought we actually already did that because other appenders didn't show before in the preview.

display: none;
}