@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/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/video-media-control.tsx +21 -2
package/dist/index.mjs
CHANGED
|
@@ -5494,21 +5494,24 @@ var SvgMediaControl = createControl(() => {
|
|
|
5494
5494
|
|
|
5495
5495
|
// src/controls/video-media-control.tsx
|
|
5496
5496
|
import * as React82 from "react";
|
|
5497
|
-
import { videoSrcPropTypeUtil } from "@elementor/editor-props";
|
|
5497
|
+
import { urlPropTypeUtil as urlPropTypeUtil5, videoSrcPropTypeUtil } from "@elementor/editor-props";
|
|
5498
5498
|
import { UploadIcon as UploadIcon3 } from "@elementor/icons";
|
|
5499
5499
|
import { Button as Button6, Card as Card3, CardMedia as CardMedia3, CardOverlay as CardOverlay3, CircularProgress as CircularProgress4, Stack as Stack14 } from "@elementor/ui";
|
|
5500
5500
|
import { useWpMediaAttachment as useWpMediaAttachment3, useWpMediaFrame as useWpMediaFrame3 } from "@elementor/wp-media";
|
|
5501
5501
|
import { __ as __33 } from "@wordpress/i18n";
|
|
5502
5502
|
var PLACEHOLDER_IMAGE = window.elementorCommon?.config?.urls?.assets + "/shapes/play-triangle.svg";
|
|
5503
5503
|
var VideoMediaControl = createControl(() => {
|
|
5504
|
-
const { value, setValue } = useBoundProp(videoSrcPropTypeUtil);
|
|
5504
|
+
const { value, setValue, propType } = useBoundProp(videoSrcPropTypeUtil);
|
|
5505
5505
|
const { id, url } = value ?? {};
|
|
5506
5506
|
const { data: attachment, isFetching } = useWpMediaAttachment3(id?.value || null);
|
|
5507
5507
|
const videoUrl = attachment?.url ?? url?.value ?? null;
|
|
5508
|
+
const defaultUrl = videoSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
|
|
5509
|
+
const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : void 0;
|
|
5508
5510
|
const { open } = useWpMediaFrame3({
|
|
5509
5511
|
mediaTypes: ["video"],
|
|
5510
5512
|
multiple: false,
|
|
5511
5513
|
selected: id?.value || null,
|
|
5514
|
+
allowUrlImport: true,
|
|
5512
5515
|
onSelect: (selectedAttachment) => {
|
|
5513
5516
|
setValue({
|
|
5514
5517
|
id: {
|
|
@@ -5517,6 +5520,12 @@ var VideoMediaControl = createControl(() => {
|
|
|
5517
5520
|
},
|
|
5518
5521
|
url: null
|
|
5519
5522
|
});
|
|
5523
|
+
},
|
|
5524
|
+
onSelectUrl: (selectedUrl) => {
|
|
5525
|
+
setValue({
|
|
5526
|
+
id: null,
|
|
5527
|
+
url: urlPropTypeUtil5.create(selectedUrl)
|
|
5528
|
+
});
|
|
5520
5529
|
}
|
|
5521
5530
|
});
|
|
5522
5531
|
return /* @__PURE__ */ React82.createElement(ControlActions, null, /* @__PURE__ */ React82.createElement(Card3, { variant: "outlined" }, /* @__PURE__ */ React82.createElement(
|
|
@@ -5554,6 +5563,15 @@ var VideoMediaControl = createControl(() => {
|
|
|
5554
5563
|
onClick: () => open({ mode: "upload" })
|
|
5555
5564
|
},
|
|
5556
5565
|
__33("Upload", "elementor")
|
|
5566
|
+
), /* @__PURE__ */ React82.createElement(
|
|
5567
|
+
Button6,
|
|
5568
|
+
{
|
|
5569
|
+
size: "tiny",
|
|
5570
|
+
variant: "text",
|
|
5571
|
+
color: "inherit",
|
|
5572
|
+
onClick: () => open({ mode: "url", currentUrl: currentUrlForModal })
|
|
5573
|
+
},
|
|
5574
|
+
__33("Insert from URL", "elementor")
|
|
5557
5575
|
)))));
|
|
5558
5576
|
});
|
|
5559
5577
|
var VideoPreview = ({ isFetching = false, videoUrl }) => {
|
|
@@ -5564,6 +5582,7 @@ var VideoPreview = ({ isFetching = false, videoUrl }) => {
|
|
|
5564
5582
|
return /* @__PURE__ */ React82.createElement(
|
|
5565
5583
|
"video",
|
|
5566
5584
|
{
|
|
5585
|
+
"aria-label": __33("Video preview", "elementor"),
|
|
5567
5586
|
src: videoUrl,
|
|
5568
5587
|
muted: true,
|
|
5569
5588
|
preload: "metadata",
|