Skip to content

Commit

Permalink
Block Editor: Remove store subscription in favor of modern CSS (#68276)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
  • Loading branch information
3 people authored Dec 25, 2024
1 parent ead6fac commit 227fcd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
22 changes: 3 additions & 19 deletions packages/block-editor/src/components/media-replace-flow/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* External dependencies
*/
import clsx from 'clsx';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -61,10 +56,7 @@ const MediaReplaceFlow = ( {
handleUpload = true,
popoverProps,
} ) => {
const mediaUpload = useSelect( ( select ) => {
return select( blockEditorStore ).getSettings().mediaUpload;
}, [] );
const canUpload = !! mediaUpload;
const { getSettings } = useSelect( blockEditorStore );
const editMediaButtonRef = useRef();
const errorNoticeID = `block-editor/media-replace-flow/error-notice/${ ++uniqueId }`;

Expand Down Expand Up @@ -107,7 +99,7 @@ const MediaReplaceFlow = ( {
return onSelect( files );
}
onFilesUpload( files );
mediaUpload( {
getSettings().mediaUpload( {
allowedTypes,
filesList: files,
onFileChange: ( [ media ] ) => {
Expand Down Expand Up @@ -219,15 +211,7 @@ const MediaReplaceFlow = ( {
</NavigableMenu>
{ onSelectURL && (
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
<form
className={ clsx(
'block-editor-media-flow__url-input',
{
'has-siblings':
canUpload || onToggleFeaturedImage,
}
) }
>
<form className="block-editor-media-flow__url-input">
<span className="block-editor-media-replace-flow__image-url-label">
{ __( 'Current media URL:' ) }
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
margin-left: 4px;
}

.block-editor-media-replace-flow__media-upload-menu:not(:empty) + .block-editor-media-flow__url-input {
border-top: $border-width solid $gray-900;
margin-top: $grid-unit-10;
padding-bottom: $grid-unit-10;
}

.block-editor-media-flow__url-input {
margin-right: -$grid-unit-10;
margin-left: -$grid-unit-10;
padding: $grid-unit-20;

&.has-siblings {
border-top: $border-width solid $gray-900;
margin-top: $grid-unit-10;
padding-bottom: $grid-unit-10;
}

.block-editor-media-replace-flow__image-url-label {
display: block;
top: $grid-unit-20;
Expand Down

1 comment on commit 227fcd8

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 227fcd8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12490127849
📝 Reported issues:

Please sign in to comment.