Skip to content

Commit

Permalink
Video Block: Remove custom CSS code for placeholder style (#64861)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
3 people authored Aug 28, 2024
1 parent 59057e8 commit bf48535
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 54 deletions.
34 changes: 17 additions & 17 deletions packages/block-library/src/video/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ import TracksEditor from './tracks-editor';
import Tracks from './tracks';
import { Caption } from '../utils/caption';

// Much of this description is duplicated from MediaPlaceholder.
const placeholder = ( content ) => {
return (
<Placeholder
className="block-editor-media-placeholder"
withIllustration
icon={ icon }
label={ __( 'Video' ) }
instructions={ __(
'Upload a video file, pick one from your media library, or add one with a URL.'
) }
>
{ content }
</Placeholder>
);
};

const ALLOWED_MEDIA_TYPES = [ 'video' ];
const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];

Expand Down Expand Up @@ -149,6 +132,23 @@ function VideoEdit( {
createErrorNotice( message, { type: 'snackbar' } );
}

// Much of this description is duplicated from MediaPlaceholder.
const placeholder = ( content ) => {
return (
<Placeholder
className="block-editor-media-placeholder"
withIllustration={ ! isSingleSelected }
icon={ icon }
label={ __( 'Video' ) }
instructions={ __(
'Upload a video file, pick one from your media library, or add one with a URL.'
) }
>
{ content }
</Placeholder>
);
};

const classes = clsx( className, {
'is-transient': !! temporaryURL,
} );
Expand Down
37 changes: 0 additions & 37 deletions packages/block-library/src/video/editor.scss
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
// Provide special styling for the placeholder.
// @todo this particular minimal style of placeholder could be componentized further.
.wp-block-video.wp-block-video {
// Show Placeholder style on-select.
&.is-selected .components-placeholder {
// Block UI appearance.
color: $gray-900;
background-color: $white;
box-shadow: inset 0 0 0 $border-width $gray-900;
border: none;

// @todo this should eventually be overridden by a custom border-radius set in the inspector.
border-radius: $radius-block-ui;

> svg {
opacity: 0;
}

.components-placeholder__illustration {
display: none;
}

&::before {
opacity: 0;
}
}

// Remove the transition while we still have a legacy placeholder style.
// Otherwise the content jumps between the 1px placeholder border, and any inherited custom
// parent border that may get applied when you deselect.
.components-placeholder__label,
.components-placeholder__instructions,
.components-button {
transition: none;
}
}

.wp-block[data-align="center"] > .wp-block-video {
text-align: center;
}
Expand Down

0 comments on commit bf48535

Please sign in to comment.