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

Add descriptive text and a link to embed documentation in embed blocks #16101

Merged
merged 4 commits into from
Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@ -37,6 +37,10 @@
.components-placeholder__error {
word-break: break-word;
}

.components-placeholder__learn-more {
margin-top: 10px;
melchoyce marked this conversation as resolved.
Show resolved Hide resolved
}
}

.block-library-embed__interactive-overlay {
Expand Down
10 changes: 9 additions & 1 deletion packages/block-library/src/embed/embed-placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { Button, Placeholder } from '@wordpress/components';
import { Button, Placeholder, ExternalLink } from '@wordpress/components';
import { BlockIcon } from '@wordpress/block-editor';

const EmbedPlaceholder = ( props ) => {
const { icon, label, value, onSubmit, onChange, cannotEmbed, fallback, tryAgain } = props;
return (
<Placeholder icon={ <BlockIcon icon={ icon } showColors /> } label={ label } className="wp-block-embed">
<div className="components-placeholder__instructions">
{ __( 'Paste a link to the content you want to display on your site.' ) }
Copy link
Contributor

@talldan talldan Jun 12, 2019

Choose a reason for hiding this comment

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

I think you should be able to pass this text straight into the Placeholder component as a prop instead of creating a separate div:

{ !! instructions && <div className="components-placeholder__instructions">{ instructions }</div> }

Something like this would work:

<Placeholder
    icon={ <BlockIcon icon={ icon } showColors /> } 
    label={ label } 
    className="wp-block-embed"
    instructions={ __( 'Paste a link to the content you want to display on your site.' ) }
>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

</div>
<form onSubmit={ onSubmit }>
<input
type="url"
Expand All @@ -29,6 +32,11 @@ const EmbedPlaceholder = ( props ) => {
</p>
}
</form>
<div className="components-placeholder__learn-more">
<ExternalLink href={ __( 'https://wordpress.org/support/article/embeds/' ) }>
{ __( 'Learn more about embeds' ) }
</ExternalLink>
</div>
</Placeholder>
);
};
Expand Down