@elementor/editor-controls 4.1.0-820 → 4.1.0-821
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 +16 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/controls/image-media-control.tsx +15 -3
package/dist/index.js
CHANGED
|
@@ -507,6 +507,9 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
|
|
|
507
507
|
const { data: attachment, isFetching } = (0, import_wp_media.useWpMediaAttachment)(id?.value || null);
|
|
508
508
|
const { data: placeholderAttachment } = (0, import_wp_media.useWpMediaAttachment)(placeholder?.id?.value || null);
|
|
509
509
|
const src = attachment?.url ?? url?.value ?? placeholderAttachment?.url ?? null;
|
|
510
|
+
const defaultUrl = import_editor_props.imageSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
|
|
511
|
+
const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : void 0;
|
|
512
|
+
const currentAltForModal = value?.alt?.value;
|
|
510
513
|
const { open } = (0, import_wp_media.useWpMediaFrame)({
|
|
511
514
|
mediaTypes,
|
|
512
515
|
multiple: false,
|
|
@@ -521,10 +524,11 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
|
|
|
521
524
|
url: null
|
|
522
525
|
});
|
|
523
526
|
},
|
|
524
|
-
onSelectUrl: (selectedUrl) => {
|
|
527
|
+
onSelectUrl: (selectedUrl, alt) => {
|
|
525
528
|
setValue({
|
|
526
529
|
id: null,
|
|
527
|
-
url: import_editor_props.urlPropTypeUtil.create(selectedUrl)
|
|
530
|
+
url: import_editor_props.urlPropTypeUtil.create(selectedUrl),
|
|
531
|
+
alt: alt ? import_editor_props.stringPropTypeUtil.create(alt) : null
|
|
528
532
|
});
|
|
529
533
|
}
|
|
530
534
|
});
|
|
@@ -547,7 +551,16 @@ var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
|
|
|
547
551
|
onClick: () => open({ mode: "upload" })
|
|
548
552
|
},
|
|
549
553
|
(0, import_i18n.__)("Upload", "elementor")
|
|
550
|
-
), /* @__PURE__ */ React11.createElement(
|
|
554
|
+
), /* @__PURE__ */ React11.createElement(
|
|
555
|
+
import_ui4.Button,
|
|
556
|
+
{
|
|
557
|
+
size: "tiny",
|
|
558
|
+
variant: "text",
|
|
559
|
+
color: "inherit",
|
|
560
|
+
onClick: () => open({ mode: "url", currentUrl: currentUrlForModal, currentAlt: currentAltForModal })
|
|
561
|
+
},
|
|
562
|
+
(0, import_i18n.__)("Insert from URL", "elementor")
|
|
563
|
+
)))));
|
|
551
564
|
});
|
|
552
565
|
|
|
553
566
|
// src/controls/select-control.tsx
|