@elementor/editor-controls 4.4.0-1137 → 4.4.0-1139

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
@@ -7059,12 +7059,14 @@ var MODE_BROWSE = { mode: "browse" };
7059
7059
  var MODE_UPLOAD = { mode: "upload" };
7060
7060
  var SvgMediaControl = createControl(({ showIconLibrary = false, label }) => {
7061
7061
  const groupLabel = label ?? __40("SVG", "elementor");
7062
- const { value: svgValue, setValue: setSvgValue } = useBoundProp(svgSrcPropTypeUtil);
7063
- const { value: iconValue, setValue: setIconValue } = useBoundProp(iconPropTypeUtil);
7062
+ const { value: svgValue, setValue: setSvgValue, placeholder: svgPlaceholder } = useBoundProp(svgSrcPropTypeUtil);
7063
+ const { value: iconValue, setValue: setIconValue, placeholder: iconPlaceholder } = useBoundProp(iconPropTypeUtil);
7064
7064
  const id = svgValue?.id;
7065
- const url = svgValue?.url;
7066
- const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
7067
- const src = attachment?.url ?? url?.value ?? null;
7065
+ const hasOwnValue = svgValue !== null && svgValue !== void 0 || iconValue !== null && iconValue !== void 0;
7066
+ const previewSvgValue = hasOwnValue ? svgValue : svgPlaceholder;
7067
+ const previewIconValue = hasOwnValue ? iconValue : iconPlaceholder;
7068
+ const { data: attachment, isFetching } = useWpMediaAttachment2(previewSvgValue?.id?.value || null);
7069
+ const src = attachment?.url ?? previewSvgValue?.url?.value ?? null;
7068
7070
  const { data: allowSvgUpload } = useUnfilteredFilesUpload();
7069
7071
  const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState22(false);
7070
7072
  const iconLibraryPopoverState = usePopupState9({ variant: "popover" });
@@ -7072,8 +7074,8 @@ var SvgMediaControl = createControl(({ showIconLibrary = false, label }) => {
7072
7074
  const buttonGroupRef = useRef18(null);
7073
7075
  const [iconLibraryAnchor, setIconLibraryAnchor] = useState22(null);
7074
7076
  const { isAdmin } = useCurrentUserCapabilities();
7075
- const selectedIconClass = showIconLibrary && typeof iconValue?.value?.value === "string" ? iconValue.value.value : null;
7076
- const selectedIconLibrary = showIconLibrary && typeof iconValue?.library?.value === "string" ? iconValue.library.value : null;
7077
+ const selectedIconClass = showIconLibrary && typeof previewIconValue?.value?.value === "string" ? previewIconValue.value.value : null;
7078
+ const selectedIconLibrary = showIconLibrary && typeof previewIconValue?.library?.value === "string" ? previewIconValue.library.value : null;
7077
7079
  const { open } = useWpMediaFrame2({
7078
7080
  mediaTypes: ["svg"],
7079
7081
  multiple: false,