@elementor/editor-controls 4.3.0-1056 → 4.3.0-1057

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-controls",
3
3
  "description": "This package contains the controls model and utils for the Elementor editor",
4
- "version": "4.3.0-1056",
4
+ "version": "4.3.0-1057",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,23 +40,23 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-current-user": "4.3.0-1056",
44
- "@elementor/editor-elements": "4.3.0-1056",
45
- "@elementor/editor-props": "4.3.0-1056",
46
- "@elementor/editor-responsive": "4.3.0-1056",
47
- "@elementor/editor-ui": "4.3.0-1056",
48
- "@elementor/editor-v1-adapters": "4.3.0-1056",
49
- "@elementor/env": "4.3.0-1056",
50
- "@elementor/events": "4.3.0-1056",
51
- "@elementor/http-client": "4.3.0-1056",
43
+ "@elementor/editor-current-user": "4.3.0-1057",
44
+ "@elementor/editor-elements": "4.3.0-1057",
45
+ "@elementor/editor-props": "4.3.0-1057",
46
+ "@elementor/editor-responsive": "4.3.0-1057",
47
+ "@elementor/editor-ui": "4.3.0-1057",
48
+ "@elementor/editor-v1-adapters": "4.3.0-1057",
49
+ "@elementor/env": "4.3.0-1057",
50
+ "@elementor/events": "4.3.0-1057",
51
+ "@elementor/http-client": "4.3.0-1057",
52
52
  "@elementor/icons": "~1.75.1",
53
- "@elementor/locations": "4.3.0-1056",
54
- "@elementor/query": "4.3.0-1056",
55
- "@elementor/schema": "4.3.0-1056",
56
- "@elementor/session": "4.3.0-1056",
53
+ "@elementor/locations": "4.3.0-1057",
54
+ "@elementor/query": "4.3.0-1057",
55
+ "@elementor/schema": "4.3.0-1057",
56
+ "@elementor/session": "4.3.0-1057",
57
57
  "@elementor/ui": "1.37.5",
58
- "@elementor/utils": "4.3.0-1056",
59
- "@elementor/wp-media": "4.3.0-1056",
58
+ "@elementor/utils": "4.3.0-1057",
59
+ "@elementor/wp-media": "4.3.0-1057",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "@tiptap/extension-bold": "^3.11.1",
62
62
  "@tiptap/extension-document": "^3.11.1",
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { videoSrcPropTypeUtil } from '@elementor/editor-props';
2
+ import { urlPropTypeUtil, videoSrcPropTypeUtil } from '@elementor/editor-props';
3
3
  import { UploadIcon } from '@elementor/icons';
4
4
  import { Button, Card, CardMedia, CardOverlay, CircularProgress, Stack } from '@elementor/ui';
5
5
  import { useWpMediaAttachment, useWpMediaFrame } from '@elementor/wp-media';
@@ -13,16 +13,20 @@ import { TILES_GRADIENT_FORMULA } from './svg-media-control';
13
13
  const PLACEHOLDER_IMAGE = window.elementorCommon?.config?.urls?.assets + '/shapes/play-triangle.svg';
14
14
 
15
15
  export const VideoMediaControl = createControl( () => {
16
- const { value, setValue } = useBoundProp( videoSrcPropTypeUtil );
16
+ const { value, setValue, propType } = useBoundProp( videoSrcPropTypeUtil );
17
17
  const { id, url } = value ?? {};
18
18
 
19
19
  const { data: attachment, isFetching } = useWpMediaAttachment( id?.value || null );
20
20
  const videoUrl = attachment?.url ?? url?.value ?? null;
21
21
 
22
+ const defaultUrl = videoSrcPropTypeUtil.extract( propType.default ?? null )?.url?.value;
23
+ const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : undefined;
24
+
22
25
  const { open } = useWpMediaFrame( {
23
26
  mediaTypes: [ 'video' ],
24
27
  multiple: false,
25
28
  selected: id?.value || null,
29
+ allowUrlImport: true,
26
30
  onSelect: ( selectedAttachment ) => {
27
31
  setValue( {
28
32
  id: {
@@ -32,6 +36,12 @@ export const VideoMediaControl = createControl( () => {
32
36
  url: null,
33
37
  } );
34
38
  },
39
+ onSelectUrl: ( selectedUrl ) => {
40
+ setValue( {
41
+ id: null,
42
+ url: urlPropTypeUtil.create( selectedUrl ),
43
+ } );
44
+ },
35
45
  } );
36
46
 
37
47
  return (
@@ -71,6 +81,14 @@ export const VideoMediaControl = createControl( () => {
71
81
  >
72
82
  { __( 'Upload', 'elementor' ) }
73
83
  </Button>
84
+ <Button
85
+ size="tiny"
86
+ variant="text"
87
+ color="inherit"
88
+ onClick={ () => open( { mode: 'url', currentUrl: currentUrlForModal } ) }
89
+ >
90
+ { __( 'Insert from URL', 'elementor' ) }
91
+ </Button>
74
92
  </Stack>
75
93
  </CardOverlay>
76
94
  </Card>
@@ -86,6 +104,7 @@ const VideoPreview = ( { isFetching = false, videoUrl }: { isFetching?: boolean;
86
104
  if ( videoUrl ) {
87
105
  return (
88
106
  <video
107
+ aria-label={ __( 'Video preview', 'elementor' ) }
89
108
  src={ videoUrl }
90
109
  muted
91
110
  preload="metadata"