1 | import { createElement } from "@wordpress/element";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import { __, _x } from '@wordpress/i18n';
|
7 | import { Button, Placeholder } from '@wordpress/components';
|
8 | import { BlockIcon } from '@wordpress/block-editor';
|
9 |
|
10 | var EmbedPlaceholder = function EmbedPlaceholder(props) {
|
11 | var icon = props.icon,
|
12 | label = props.label,
|
13 | value = props.value,
|
14 | onSubmit = props.onSubmit,
|
15 | onChange = props.onChange,
|
16 | cannotEmbed = props.cannotEmbed,
|
17 | fallback = props.fallback,
|
18 | tryAgain = props.tryAgain;
|
19 | return createElement(Placeholder, {
|
20 | icon: createElement(BlockIcon, {
|
21 | icon: icon,
|
22 | showColors: true
|
23 | }),
|
24 | label: label,
|
25 | className: "wp-block-embed"
|
26 | }, createElement("form", {
|
27 | onSubmit: onSubmit
|
28 | }, createElement("input", {
|
29 | type: "url",
|
30 | value: value || '',
|
31 | className: "components-placeholder__input",
|
32 | "aria-label": label,
|
33 | placeholder: __('Enter URL to embed here…'),
|
34 | onChange: onChange
|
35 | }), createElement(Button, {
|
36 | isLarge: true,
|
37 | type: "submit"
|
38 | }, _x('Embed', 'button label')), cannotEmbed && createElement("p", {
|
39 | className: "components-placeholder__error"
|
40 | }, __('Sorry, this content could not be embedded.'), createElement("br", null), createElement(Button, {
|
41 | isLarge: true,
|
42 | onClick: tryAgain
|
43 | }, _x('Try again', 'button label')), " ", createElement(Button, {
|
44 | isLarge: true,
|
45 | onClick: fallback
|
46 | }, _x('Convert to link', 'button label')))));
|
47 | };
|
48 |
|
49 | export default EmbedPlaceholder;
|
50 |
|
\ | No newline at end of file |