@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.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.js
CHANGED
|
@@ -7092,12 +7092,14 @@ var MODE_BROWSE = { mode: "browse" };
|
|
|
7092
7092
|
var MODE_UPLOAD = { mode: "upload" };
|
|
7093
7093
|
var SvgMediaControl = createControl(({ showIconLibrary = false, label }) => {
|
|
7094
7094
|
const groupLabel = label ?? (0, import_i18n40.__)("SVG", "elementor");
|
|
7095
|
-
const { value: svgValue, setValue: setSvgValue } = useBoundProp(import_editor_props35.svgSrcPropTypeUtil);
|
|
7096
|
-
const { value: iconValue, setValue: setIconValue } = useBoundProp(import_editor_props35.iconPropTypeUtil);
|
|
7095
|
+
const { value: svgValue, setValue: setSvgValue, placeholder: svgPlaceholder } = useBoundProp(import_editor_props35.svgSrcPropTypeUtil);
|
|
7096
|
+
const { value: iconValue, setValue: setIconValue, placeholder: iconPlaceholder } = useBoundProp(import_editor_props35.iconPropTypeUtil);
|
|
7097
7097
|
const id = svgValue?.id;
|
|
7098
|
-
const
|
|
7099
|
-
const
|
|
7100
|
-
const
|
|
7098
|
+
const hasOwnValue = svgValue !== null && svgValue !== void 0 || iconValue !== null && iconValue !== void 0;
|
|
7099
|
+
const previewSvgValue = hasOwnValue ? svgValue : svgPlaceholder;
|
|
7100
|
+
const previewIconValue = hasOwnValue ? iconValue : iconPlaceholder;
|
|
7101
|
+
const { data: attachment, isFetching } = (0, import_wp_media2.useWpMediaAttachment)(previewSvgValue?.id?.value || null);
|
|
7102
|
+
const src = attachment?.url ?? previewSvgValue?.url?.value ?? null;
|
|
7101
7103
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
7102
7104
|
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0, import_react56.useState)(false);
|
|
7103
7105
|
const iconLibraryPopoverState = (0, import_ui75.usePopupState)({ variant: "popover" });
|
|
@@ -7105,8 +7107,8 @@ var SvgMediaControl = createControl(({ showIconLibrary = false, label }) => {
|
|
|
7105
7107
|
const buttonGroupRef = (0, import_react56.useRef)(null);
|
|
7106
7108
|
const [iconLibraryAnchor, setIconLibraryAnchor] = (0, import_react56.useState)(null);
|
|
7107
7109
|
const { isAdmin } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
7108
|
-
const selectedIconClass = showIconLibrary && typeof
|
|
7109
|
-
const selectedIconLibrary = showIconLibrary && typeof
|
|
7110
|
+
const selectedIconClass = showIconLibrary && typeof previewIconValue?.value?.value === "string" ? previewIconValue.value.value : null;
|
|
7111
|
+
const selectedIconLibrary = showIconLibrary && typeof previewIconValue?.library?.value === "string" ? previewIconValue.library.value : null;
|
|
7110
7112
|
const { open } = (0, import_wp_media2.useWpMediaFrame)({
|
|
7111
7113
|
mediaTypes: ["svg"],
|
|
7112
7114
|
multiple: false,
|