@elementor/editor-controls 4.4.0-1137 → 4.4.0-1138
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 +9 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/svg-media-control.tsx +17 -7
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
|
|
7066
|
-
const
|
|
7067
|
-
const
|
|
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
|
|
7076
|
-
const selectedIconLibrary = showIconLibrary && typeof
|
|
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,
|