Iframe.js
7 years ago
core-embeds.js
7 years ago
embed-controls.js
6 years ago
embed-loading.js
7 years ago
embed-placeholder.js
6 years ago
icons.js
6 years ago
embed-placeholder.js
36 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | const { __, _x } = wp.i18n; |
| 5 | const { Button, Placeholder } = wp.components; |
| 6 | const { BlockIcon } = wp.blockEditor; |
| 7 | |
| 8 | const EmbedPlaceholder = ( props ) => { |
| 9 | const { icon, label, value, onSubmit, onChange, cannotEmbed } = props; |
| 10 | return ( |
| 11 | <Placeholder icon={ <BlockIcon icon={ icon } showColors /> } label={ label } className="wp-block-embed"> |
| 12 | <form onSubmit={ onSubmit }> |
| 13 | <input |
| 14 | type="url" |
| 15 | value={ value || '' } |
| 16 | className="components-placeholder__input" |
| 17 | aria-label={ label } |
| 18 | placeholder={ __( 'Enter URL to embed here…' ) } |
| 19 | onChange={ onChange } /> |
| 20 | <Button |
| 21 | isLarge |
| 22 | type="submit"> |
| 23 | { _x( 'Embed', 'button label' ) } |
| 24 | </Button> |
| 25 | { cannotEmbed && |
| 26 | <p className="components-placeholder__error"> |
| 27 | { __( 'Sorry, we could not embed that content.' ) }<br /> |
| 28 | </p> |
| 29 | } |
| 30 | </form> |
| 31 | </Placeholder> |
| 32 | ); |
| 33 | }; |
| 34 | |
| 35 | export default EmbedPlaceholder; |
| 36 |