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

Embed Block: Replace native input element with InputControl component #64668

Merged
merged 2 commits into from
Aug 21, 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
2 changes: 1 addition & 1 deletion packages/block-library/src/embed/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const EmbedEdit = ( props ) => {
} }
value={ url }
cannotEmbed={ cannotEmbed }
onChange={ ( event ) => setURL( event.target.value ) }
onChange={ ( value ) => setURL( value ) }
fallback={ () => fallback( url, onReplace ) }
tryAgain={ () => {
invalidateResolution( 'getEmbedPreview', [ url ] );
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/embed/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
justify-content: center;
}

.wp-block-embed__placeholder-input {
flex: 1 1 auto;
}

// Stops long URLs from breaking out of the no preview available screen
.components-placeholder__error {
word-break: break-word;
Expand Down
11 changes: 7 additions & 4 deletions packages/block-library/src/embed/embed-placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ExternalLink,
__experimentalHStack as HStack,
__experimentalVStack as VStack,
__experimentalInputControl as InputControl,
} from '@wordpress/components';
import { BlockIcon } from '@wordpress/block-editor';

Expand All @@ -31,15 +32,17 @@ const EmbedPlaceholder = ( {
) }
>
<form onSubmit={ onSubmit }>
<input
<InputControl
__next40pxDefaultSize
type="url"
value={ value || '' }
className="components-placeholder__input"
aria-label={ label }
className="wp-block-embed__placeholder-input"
label={ label }
hideLabelFromVision
placeholder={ __( 'Enter URL to embed here…' ) }
onChange={ onChange }
/>
<Button variant="primary" type="submit">
<Button __next40pxDefaultSize variant="primary" type="submit">
{ _x( 'Embed', 'button label' ) }
</Button>
</form>
Expand Down
Loading