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

Inserter: Fade pattern previews in #63576

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function ScaledBlockPreview( {
? minHeight / scale
: minHeight,
} }
withLoadingEffects
>
<EditorStyles styles={ editorStyles } />
{ contentResizeListener }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.block-editor-block-preview__content-iframe {
opacity: 0;
transition: opacity 1s ease-in-out;
transition-delay: 0.5s;
}

// Hide inserter from previews.
.block-editor-block-preview__content-iframe .block-list-appender {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

.block-editor-iframe__html {
transform-origin: top center;
transition: transform 0.3s;
transition: transform 0.3s, opacity 0.5s ease-in-out 0.1s;
@include reduce-motion("transition");
}

Expand Down
5 changes: 5 additions & 0 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function Iframe( {
readonly,
forwardedRef: ref,
title = __( 'Editor canvas' ),
withLoadingEffects,
...props
} ) {
const { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {
Expand Down Expand Up @@ -191,6 +192,10 @@ function Iframe( {
preventFileDropDefault,
false
);

if ( withLoadingEffects ) {
documentElement.style.setProperty( 'opacity', 1 );
}
}

node.addEventListener( 'load', onLoad );
Expand Down
Loading