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

MediaReplaceFlow: Remove store subscription in favor of modern CSS #68276

Merged
merged 1 commit into from
Dec 25, 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
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
Loading