@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 CHANGED
@@ -5553,14 +5553,17 @@ var import_wp_media3 = require("@elementor/wp-media");
5553
5553
  var import_i18n33 = require("@wordpress/i18n");
5554
5554
  var PLACEHOLDER_IMAGE = window.elementorCommon?.config?.urls?.assets + "/shapes/play-triangle.svg";
5555
5555
  var VideoMediaControl = createControl(() => {
5556
- const { value, setValue } = useBoundProp(import_editor_props35.videoSrcPropTypeUtil);
5556
+ const { value, setValue, propType } = useBoundProp(import_editor_props35.videoSrcPropTypeUtil);
5557
5557
  const { id, url } = value ?? {};
5558
5558
  const { data: attachment, isFetching } = (0, import_wp_media3.useWpMediaAttachment)(id?.value || null);
5559
5559
  const videoUrl = attachment?.url ?? url?.value ?? null;
5560
+ const defaultUrl = import_editor_props35.videoSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
5561
+ const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : void 0;
5560
5562
  const { open } = (0, import_wp_media3.useWpMediaFrame)({
5561
5563
  mediaTypes: ["video"],
5562
5564
  multiple: false,
5563
5565
  selected: id?.value || null,
5566
+ allowUrlImport: true,
5564
5567
  onSelect: (selectedAttachment) => {
5565
5568
  setValue({
5566
5569
  id: {
@@ -5569,6 +5572,12 @@ var VideoMediaControl = createControl(() => {
5569
5572
  },
5570
5573
  url: null
5571
5574
  });
5575
+ },
5576
+ onSelectUrl: (selectedUrl) => {
5577
+ setValue({
5578
+ id: null,
5579
+ url: import_editor_props35.urlPropTypeUtil.create(selectedUrl)
5580
+ });
5572
5581
  }
5573
5582
  });
5574
5583
  return /* @__PURE__ */ React82.createElement(ControlActions, null, /* @__PURE__ */ React82.createElement(import_ui65.Card, { variant: "outlined" }, /* @__PURE__ */ React82.createElement(
@@ -5606,6 +5615,15 @@ var VideoMediaControl = createControl(() => {
5606
5615
  onClick: () => open({ mode: "upload" })
5607
5616
  },
5608
5617
  (0, import_i18n33.__)("Upload", "elementor")
5618
+ ), /* @__PURE__ */ React82.createElement(
5619
+ import_ui65.Button,
5620
+ {
5621
+ size: "tiny",
5622
+ variant: "text",
5623
+ color: "inherit",
5624
+ onClick: () => open({ mode: "url", currentUrl: currentUrlForModal })
5625
+ },
5626
+ (0, import_i18n33.__)("Insert from URL", "elementor")
5609
5627
  )))));
5610
5628
  });
5611
5629
  var VideoPreview = ({ isFetching = false, videoUrl }) => {
@@ -5616,6 +5634,7 @@ var VideoPreview = ({ isFetching = false, videoUrl }) => {
5616
5634
  return /* @__PURE__ */ React82.createElement(
5617
5635
  "video",
5618
5636
  {
5637
+ "aria-label": (0, import_i18n33.__)("Video preview", "elementor"),
5619
5638
  src: videoUrl,
5620
5639
  muted: true,
5621
5640
  preload: "metadata",