MediaProviders
1 week ago
ProvidersPlaceholder
1 week ago
audioPresets
1 week ago
branding
6 months ago
chapters
2 years ago
components
1 week ago
media
1 week ago
overlays
1 week ago
presets
1 week ago
services
4 years ago
settings
1 month ago
styles
1 year ago
tracks
1 week ago
BlockInspectorControls.js
1 week ago
BlockInspectorControls.scss
1 week ago
Editing.js
1 year ago
LinkPlaceholder.js
1 month ago
Player.js
1 month ago
Preview.js
2 years ago
ProUpgradeModal.js
1 month ago
VisibilityEditor.js
6 months ago
audio-placeholder.js
1 week ago
helpers.js
5 years ago
options.js
1 week ago
placeholder.js
1 week ago
LinkPlaceholder.js
60 lines
| 1 | const { |
| 2 | Button, |
| 3 | Placeholder, |
| 4 | TextControl, |
| 5 | Flex, |
| 6 | FlexItem, |
| 7 | FlexBlock, |
| 8 | } = wp.components; |
| 9 | const { useState } = wp.element; |
| 10 | const { __ } = wp.i18n; |
| 11 | |
| 12 | export default function ({ |
| 13 | attributes, |
| 14 | setAttributes, |
| 15 | icon, |
| 16 | onSelectURL, |
| 17 | label, |
| 18 | instructions, |
| 19 | placeholder, |
| 20 | }) { |
| 21 | const { src } = attributes; |
| 22 | const [state, setState] = useState({ src }); |
| 23 | return ( |
| 24 | <Placeholder |
| 25 | icon={icon} |
| 26 | label={label || __("Presto Embedded Video", "presto-player")} |
| 27 | instructions={instructions || __("Enter video URL", "presto-player")} |
| 28 | > |
| 29 | <form |
| 30 | onSubmit={(e) => { |
| 31 | e.preventDefault(); |
| 32 | onSelectURL(state.url); |
| 33 | }} |
| 34 | > |
| 35 | <Flex |
| 36 | align="flex-end" |
| 37 | gap={2} |
| 38 | style={{ width: "100%", maxWidth: "400px" }} |
| 39 | > |
| 40 | <FlexBlock> |
| 41 | <TextControl |
| 42 | type="url" |
| 43 | className={"presto-link-placeholder-input"} |
| 44 | placeholder={placeholder || __("Youtube URL", "presto-player")} |
| 45 | value={state.url} |
| 46 | onChange={(url) => setState({ url })} |
| 47 | __nextHasNoMarginBottom |
| 48 | /> |
| 49 | </FlexBlock> |
| 50 | <FlexItem> |
| 51 | <Button isPrimary type="submit"> |
| 52 | {__("Add Video", "presto-player")} |
| 53 | </Button> |
| 54 | </FlexItem> |
| 55 | </Flex> |
| 56 | </form> |
| 57 | </Placeholder> |
| 58 | ); |
| 59 | } |
| 60 |