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

Audio Block: Placeholder with illustration #64691

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
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
18 changes: 18 additions & 0 deletions packages/block-library/src/audio/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
SelectControl,
Spinner,
ToggleControl,
Placeholder,
} from '@wordpress/components';
import {
BlockControls,
Expand Down Expand Up @@ -128,6 +129,22 @@ function AudioEdit( {
} );

if ( ! src && ! temporaryURL ) {
const placeholder = ( content ) => {
return (
<Placeholder
className="block-editor-media-placeholder"
withIllustration={ ! isSingleSelected }
icon={ icon }
label={ __( 'Audio' ) }
instructions={ __(
'Upload a audio file, pick one from your media library, or add one with a URL.'
) }
>
{ content }
</Placeholder>
);
};

return (
<div { ...blockProps }>
<MediaPlaceholder
Expand All @@ -138,6 +155,7 @@ function AudioEdit( {
allowedTypes={ ALLOWED_MEDIA_TYPES }
value={ attributes }
onError={ onUploadError }
placeholder={ placeholder }
/>
</div>
);
Expand Down
Loading