@elementor/editor-controls 4.1.0-798 → 4.1.0-799

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.mjs CHANGED
@@ -351,7 +351,7 @@ var formatResponse = (response) => {
351
351
 
352
352
  // src/controls/image-media-control.tsx
353
353
  import * as React11 from "react";
354
- import { imageSrcPropTypeUtil } from "@elementor/editor-props";
354
+ import { imageSrcPropTypeUtil, urlPropTypeUtil } from "@elementor/editor-props";
355
355
  import { UploadIcon } from "@elementor/icons";
356
356
  import { Button, Card, CardMedia, CardOverlay, CircularProgress, Stack as Stack2 } from "@elementor/ui";
357
357
  import { useWpMediaAttachment, useWpMediaFrame } from "@elementor/wp-media";
@@ -396,6 +396,7 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
396
396
  mediaTypes,
397
397
  multiple: false,
398
398
  selected: id?.value || null,
399
+ allowUrlImport: true,
399
400
  onSelect: (selectedAttachment) => {
400
401
  setValue({
401
402
  id: {
@@ -404,6 +405,12 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
404
405
  },
405
406
  url: null
406
407
  });
408
+ },
409
+ onSelectUrl: (selectedUrl) => {
410
+ setValue({
411
+ id: null,
412
+ url: urlPropTypeUtil.create(selectedUrl)
413
+ });
407
414
  }
408
415
  });
409
416
  return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React11.createElement(CardMedia, { image: src, sx: { height: propType.meta.isDynamic ? 134 : 150 } }, isFetching ? /* @__PURE__ */ React11.createElement(Stack2, { justifyContent: "center", alignItems: "center", width: "100%", height: "100%" }, /* @__PURE__ */ React11.createElement(CircularProgress, null)) : /* @__PURE__ */ React11.createElement(React11.Fragment, null)), /* @__PURE__ */ React11.createElement(CardOverlay, null, /* @__PURE__ */ React11.createElement(Stack2, { gap: 1 }, /* @__PURE__ */ React11.createElement(
@@ -425,7 +432,7 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
425
432
  onClick: () => open({ mode: "upload" })
426
433
  },
427
434
  __("Upload", "elementor")
428
- )))));
435
+ ), /* @__PURE__ */ React11.createElement(Button, { size: "tiny", variant: "text", color: "inherit", onClick: () => open({ mode: "url" }) }, __("Insert from URL", "elementor"))))));
429
436
  });
430
437
 
431
438
  // src/controls/select-control.tsx
@@ -4064,11 +4071,11 @@ var FontFamilyControl = createControl(
4064
4071
 
4065
4072
  // src/controls/url-control.tsx
4066
4073
  import * as React67 from "react";
4067
- import { urlPropTypeUtil } from "@elementor/editor-props";
4074
+ import { urlPropTypeUtil as urlPropTypeUtil2 } from "@elementor/editor-props";
4068
4075
  import { TextField as TextField7 } from "@elementor/ui";
4069
4076
  var UrlControl = createControl(
4070
4077
  ({ placeholder: propPlaceholder, ariaLabel }) => {
4071
- const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(urlPropTypeUtil);
4078
+ const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(urlPropTypeUtil2);
4072
4079
  const handleChange = (event) => setValue(event.target.value);
4073
4080
  const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
4074
4081
  return /* @__PURE__ */ React67.createElement(ControlActions, null, /* @__PURE__ */ React67.createElement(
@@ -4169,7 +4176,7 @@ import {
4169
4176
  numberPropTypeUtil as numberPropTypeUtil2,
4170
4177
  queryPropTypeUtil,
4171
4178
  stringPropTypeUtil as stringPropTypeUtil8,
4172
- urlPropTypeUtil as urlPropTypeUtil2
4179
+ urlPropTypeUtil as urlPropTypeUtil3
4173
4180
  } from "@elementor/editor-props";
4174
4181
  import { httpService as httpService2 } from "@elementor/http-client";
4175
4182
  import { SearchIcon } from "@elementor/icons";
@@ -4310,7 +4317,7 @@ function factoryFilter(newValue, options, minInputLength) {
4310
4317
  // src/controls/query-control.tsx
4311
4318
  var QueryControl = createControl((props) => {
4312
4319
  const { value: queryValue, setValue: setQueryValue } = useBoundProp(queryPropTypeUtil);
4313
- const { value: urlValue, setValue: setUrlValue, placeholder: urlPlaceholder } = useBoundProp(urlPropTypeUtil2);
4320
+ const { value: urlValue, setValue: setUrlValue, placeholder: urlPlaceholder } = useBoundProp(urlPropTypeUtil3);
4314
4321
  const {
4315
4322
  allowCustomValues = true,
4316
4323
  queryOptions: { url, params = {} },
@@ -4343,7 +4350,7 @@ var QueryControl = createControl((props) => {
4343
4350
  return;
4344
4351
  }
4345
4352
  setUrlValue(trimmedValue);
4346
- onSetValue?.(urlPropTypeUtil2.create(trimmedValue));
4353
+ onSetValue?.(urlPropTypeUtil3.create(trimmedValue));
4347
4354
  updateOptions(newValue);
4348
4355
  };
4349
4356
  const updateOptions = (newValue) => {
@@ -4888,7 +4895,7 @@ var AspectRatioControl = createControl(({ label }) => {
4888
4895
  import * as React78 from "react";
4889
4896
  import { useState as useState16 } from "react";
4890
4897
  import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
4891
- import { svgSrcPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil3 } from "@elementor/editor-props";
4898
+ import { svgSrcPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil4 } from "@elementor/editor-props";
4892
4899
  import { UploadIcon as UploadIcon2 } from "@elementor/icons";
4893
4900
  import { Button as Button5, Card as Card2, CardMedia as CardMedia2, CardOverlay as CardOverlay2, CircularProgress as CircularProgress3, Stack as Stack13, styled as styled9, ThemeProvider } from "@elementor/ui";
4894
4901
  import { useWpMediaAttachment as useWpMediaAttachment2, useWpMediaFrame as useWpMediaFrame2 } from "@elementor/wp-media";
@@ -4998,7 +5005,7 @@ var SvgMediaControl = createControl(() => {
4998
5005
  $$type: "image-attachment-id",
4999
5006
  value: selectedAttachment.id
5000
5007
  },
5001
- url: urlPropTypeUtil3.create(selectedAttachment.url)
5008
+ url: urlPropTypeUtil4.create(selectedAttachment.url)
5002
5009
  });
5003
5010
  }
5004
5011
  });