@ozguraltan/strapi-content-input 1.0.21 → 1.0.22
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/README.md +33 -7
- package/dist/admin/{AnalyticsHubPage-0p0Mx4AU.js → AnalyticsHubPage-B1_chQkG.js} +2 -2
- package/dist/admin/{AnalyticsHubPage-DsrcGI_Y.mjs → AnalyticsHubPage-DUj3D2kA.mjs} +2 -2
- package/dist/admin/{ContentInputField-CHXrzvE-.mjs → ContentInputField-BrtpTCDd.mjs} +365 -173
- package/dist/admin/{ContentInputField-7rWLSx_7.js → ContentInputField-CQFQxxgm.js} +365 -173
- package/dist/admin/{SurveyWidgetEditor-BmgYQaQS.js → SurveyWidgetEditor-C5Uvyf_h.js} +81 -31
- package/dist/admin/{SurveyWidgetEditor-BVN6X_3G.mjs → SurveyWidgetEditor-DGSwgTzR.mjs} +81 -31
- package/dist/admin/{index-hFIuYqu5.mjs → index-Dc7AFLOj.mjs} +2 -2
- package/dist/admin/{index-CZAwXCFH.js → index-i0NfSYto.js} +2 -2
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/common/CIImageSettingsControl.d.ts +17 -0
- package/dist/admin/src/components/widgets/CustomCardWidgetEditor.d.ts +1 -0
- package/dist/admin/src/components/widgets/HeroSliderStage.d.ts +3 -0
- package/dist/admin/src/core/canvasClasses.d.ts +1 -0
- package/dist/admin/src/core/types.d.ts +12 -0
- package/dist/server/index.js +1176 -184
- package/dist/server/index.mjs +1176 -184
- package/dist/server/src/config/index.d.ts +4 -0
- package/dist/server/src/controllers/ci-image.d.ts +11 -2
- package/dist/server/src/controllers/index.d.ts +1 -0
- package/dist/server/src/index.d.ts +5 -0
- package/dist/server/src/utils/image-variants.d.ts +74 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const ReactDOM = require("react-dom");
|
|
5
5
|
const admin = require("@strapi/strapi/admin");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-i0NfSYto.js");
|
|
7
7
|
const cloneDeep = require("lodash/cloneDeep");
|
|
8
8
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
9
|
const ReactDOM__default = /* @__PURE__ */ _interopDefault(ReactDOM);
|
|
@@ -3782,9 +3782,33 @@ function mapStrapiFileToAsset(file, cacheBust) {
|
|
|
3782
3782
|
const sep = u.includes("?") ? "&" : "?";
|
|
3783
3783
|
return `${u}${sep}v=${Date.now()}`;
|
|
3784
3784
|
};
|
|
3785
|
+
const keepStandard = /* @__PURE__ */ new Set(["thumbnail", "small", "medium", "large"]);
|
|
3786
|
+
const compactFormats = {};
|
|
3787
|
+
let detectedOptimizedUrl = "";
|
|
3788
|
+
if (file?.formats && typeof file.formats === "object") {
|
|
3789
|
+
for (const [k, fmt] of Object.entries(file.formats)) {
|
|
3790
|
+
if (!fmt || typeof fmt !== "object" || typeof fmt.url !== "string" || !fmt.url) continue;
|
|
3791
|
+
if (!keepStandard.has(k) && !k.startsWith("ci_")) continue;
|
|
3792
|
+
compactFormats[k] = {
|
|
3793
|
+
url: fmt.url,
|
|
3794
|
+
...fmt.width ? { width: Number(fmt.width) } : {},
|
|
3795
|
+
...fmt.height ? { height: Number(fmt.height) } : {},
|
|
3796
|
+
...fmt.mime ? { mime: String(fmt.mime) } : {},
|
|
3797
|
+
...fmt.size ? { size: Number(fmt.size) } : {}
|
|
3798
|
+
};
|
|
3799
|
+
if (k.startsWith("ci_auto_") && !detectedOptimizedUrl) {
|
|
3800
|
+
detectedOptimizedUrl = fmt.url;
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3785
3804
|
const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
|
|
3786
|
-
const
|
|
3805
|
+
const rawMasterUrl = file.url || "";
|
|
3806
|
+
const finalUrl = appendBust(rawMasterUrl);
|
|
3787
3807
|
return {
|
|
3808
|
+
...file.id !== void 0 ? { id: file.id } : {},
|
|
3809
|
+
...file.hash ? { hash: file.hash } : {},
|
|
3810
|
+
original_url: rawMasterUrl,
|
|
3811
|
+
...detectedOptimizedUrl ? { optimized_url: appendBust(detectedOptimizedUrl) } : {},
|
|
3788
3812
|
target_url: finalUrl,
|
|
3789
3813
|
url: finalUrl,
|
|
3790
3814
|
filename: file.name || file.filename || "media",
|
|
@@ -3793,7 +3817,8 @@ function mapStrapiFileToAsset(file, cacheBust) {
|
|
|
3793
3817
|
width: file.width || void 0,
|
|
3794
3818
|
height: file.height || void 0,
|
|
3795
3819
|
caption: file.caption || file.alternativeText || "",
|
|
3796
|
-
srcset: srcset || void 0
|
|
3820
|
+
srcset: srcset || void 0,
|
|
3821
|
+
...Object.keys(compactFormats).length > 0 ? { formats: compactFormats } : {}
|
|
3797
3822
|
};
|
|
3798
3823
|
}
|
|
3799
3824
|
const ASPECT_PRESETS = [
|
|
@@ -3930,15 +3955,56 @@ const StrapiMediaPicker = ({
|
|
|
3930
3955
|
setModalOpen(true);
|
|
3931
3956
|
loadLibrary().finally(() => setLoading(false));
|
|
3932
3957
|
};
|
|
3958
|
+
const isRasterCandidate = (asset) => {
|
|
3959
|
+
if (!asset) return false;
|
|
3960
|
+
const m = String(asset.mime_type || "").toLowerCase();
|
|
3961
|
+
const u = String(asset.original_url || asset.url || asset.target_url || "").split("?")[0].toLowerCase();
|
|
3962
|
+
if (m.includes("svg") || m.includes("gif") || m.startsWith("video/") || m.startsWith("audio/") || m.startsWith("application/")) {
|
|
3963
|
+
return false;
|
|
3964
|
+
}
|
|
3965
|
+
if (/\.(svg|gif|mp4|webm|mov|pdf|docx?|xlsx?|pptx?|zip)$/i.test(u)) return false;
|
|
3966
|
+
return m.startsWith("image/") || /\.(jpe?g|png|webp|avif|tiff?|bmp)$/i.test(u);
|
|
3967
|
+
};
|
|
3968
|
+
const emitSingleAsset = (asset) => {
|
|
3969
|
+
onChange(asset);
|
|
3970
|
+
if (asset && asset.id && isRasterCandidate(asset) && !asset.optimized_url) {
|
|
3971
|
+
post("/content-input/media/optimize", { asset }).then((res) => {
|
|
3972
|
+
const enriched = res?.data?.data || res?.data;
|
|
3973
|
+
if (enriched && (enriched.optimized_url || enriched.formats)) {
|
|
3974
|
+
onChange(enriched);
|
|
3975
|
+
}
|
|
3976
|
+
}).catch(() => {
|
|
3977
|
+
});
|
|
3978
|
+
}
|
|
3979
|
+
};
|
|
3980
|
+
const emitMultipleAssets = async (assets) => {
|
|
3981
|
+
if (!assets || assets.length === 0) return;
|
|
3982
|
+
let finalAssets = assets;
|
|
3983
|
+
if (assets.some((a) => a.id && isRasterCandidate(a))) {
|
|
3984
|
+
try {
|
|
3985
|
+
const res = await post("/content-input/media/optimize", { assets });
|
|
3986
|
+
const enrichedList = res?.data?.data || res?.data;
|
|
3987
|
+
if (Array.isArray(enrichedList) && enrichedList.length === assets.length) {
|
|
3988
|
+
finalAssets = enrichedList;
|
|
3989
|
+
}
|
|
3990
|
+
} catch {
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
if (onSelectMultiple) {
|
|
3994
|
+
onSelectMultiple(finalAssets);
|
|
3995
|
+
} else {
|
|
3996
|
+
finalAssets.forEach((a) => onChange(a));
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3933
3999
|
const handleOpenCropCurrent = async (e) => {
|
|
3934
4000
|
e.preventDefault();
|
|
3935
4001
|
e.stopPropagation();
|
|
3936
|
-
const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
|
|
3937
|
-
if (!currentUrl) return;
|
|
4002
|
+
const currentUrl = (value?.original_url || value?.target_url || value?.url || "").split("?")[0];
|
|
4003
|
+
if (!currentUrl && !value?.id) return;
|
|
3938
4004
|
setModalOpen(true);
|
|
3939
4005
|
const loaded = await loadLibrary();
|
|
3940
4006
|
const match = loaded.find(
|
|
3941
|
-
(f) => f.url && f.url.split("?")[0] === currentUrl || f.url && currentUrl.endsWith(f.url.split("?")[0]) || value?.filename && f.name === value.filename
|
|
4007
|
+
(f) => value?.id !== void 0 && Number(f.id) === Number(value.id) || value?.hash && f.hash === value.hash || f.url && currentUrl && f.url.split("?")[0] === currentUrl || f.url && currentUrl && currentUrl.endsWith(f.url.split("?")[0]) || value?.filename && f.name === value.filename
|
|
3942
4008
|
);
|
|
3943
4009
|
if (match) {
|
|
3944
4010
|
openEditorForFile(match, "crop");
|
|
@@ -3957,13 +4023,9 @@ const StrapiMediaPicker = ({
|
|
|
3957
4023
|
const handleConfirmMultiple = () => {
|
|
3958
4024
|
if (selectedFiles.length === 0) return;
|
|
3959
4025
|
const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
|
|
3960
|
-
if (onSelectMultiple) {
|
|
3961
|
-
onSelectMultiple(assets);
|
|
3962
|
-
} else {
|
|
3963
|
-
assets.forEach((asset) => onChange(asset));
|
|
3964
|
-
}
|
|
3965
4026
|
setSelectedFiles([]);
|
|
3966
4027
|
setModalOpen(false);
|
|
4028
|
+
void emitMultipleAssets(assets);
|
|
3967
4029
|
};
|
|
3968
4030
|
const handleFileUpload = async (e) => {
|
|
3969
4031
|
const inputFiles = e.target.files;
|
|
@@ -3984,19 +4046,15 @@ const StrapiMediaPicker = ({
|
|
|
3984
4046
|
if (!modalOpen) {
|
|
3985
4047
|
if (multiple) {
|
|
3986
4048
|
const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
|
|
3987
|
-
|
|
3988
|
-
onSelectMultiple(assets);
|
|
3989
|
-
} else {
|
|
3990
|
-
assets.forEach((a) => onChange(a));
|
|
3991
|
-
}
|
|
4049
|
+
await emitMultipleAssets(assets);
|
|
3992
4050
|
} else {
|
|
3993
|
-
|
|
4051
|
+
emitSingleAsset(mapStrapiFileToAsset(uploadedList[0]));
|
|
3994
4052
|
}
|
|
3995
4053
|
} else if (multiple) {
|
|
3996
4054
|
setSelectedFiles((prev) => [...prev, ...uploadedList]);
|
|
3997
4055
|
} else {
|
|
3998
|
-
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
3999
4056
|
setModalOpen(false);
|
|
4057
|
+
emitSingleAsset(mapStrapiFileToAsset(uploadedList[0]));
|
|
4000
4058
|
}
|
|
4001
4059
|
}
|
|
4002
4060
|
} catch {
|
|
@@ -5618,21 +5676,17 @@ const StrapiMediaPicker = ({
|
|
|
5618
5676
|
if (multiple) {
|
|
5619
5677
|
toggleFileSelection(file);
|
|
5620
5678
|
} else {
|
|
5621
|
-
onChange(mapStrapiFileToAsset(file));
|
|
5622
5679
|
setModalOpen(false);
|
|
5680
|
+
emitSingleAsset(mapStrapiFileToAsset(file));
|
|
5623
5681
|
}
|
|
5624
5682
|
},
|
|
5625
5683
|
onDoubleClick: () => {
|
|
5626
5684
|
if (multiple) {
|
|
5627
5685
|
const asset = mapStrapiFileToAsset(file);
|
|
5628
5686
|
const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
|
|
5629
|
-
if (onSelectMultiple) {
|
|
5630
|
-
onSelectMultiple(listToCommit);
|
|
5631
|
-
} else {
|
|
5632
|
-
listToCommit.forEach((a) => onChange(a));
|
|
5633
|
-
}
|
|
5634
5687
|
setSelectedFiles([]);
|
|
5635
5688
|
setModalOpen(false);
|
|
5689
|
+
void emitMultipleAssets(listToCommit);
|
|
5636
5690
|
}
|
|
5637
5691
|
},
|
|
5638
5692
|
style: {
|
|
@@ -6033,19 +6087,15 @@ const StrapiMediaPicker = ({
|
|
|
6033
6087
|
multiple,
|
|
6034
6088
|
onClose: () => setNativeDialogOpen(false),
|
|
6035
6089
|
onSelectAssets: (selectedAssets) => {
|
|
6090
|
+
setNativeDialogOpen(false);
|
|
6036
6091
|
if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
|
|
6037
6092
|
const mapped = selectedAssets.map((f) => mapStrapiFileToAsset(f));
|
|
6038
6093
|
if (multiple) {
|
|
6039
|
-
|
|
6040
|
-
onSelectMultiple(mapped);
|
|
6041
|
-
} else {
|
|
6042
|
-
mapped.forEach((asset) => onChange(asset));
|
|
6043
|
-
}
|
|
6094
|
+
void emitMultipleAssets(mapped);
|
|
6044
6095
|
} else {
|
|
6045
|
-
|
|
6096
|
+
emitSingleAsset(mapped[0]);
|
|
6046
6097
|
}
|
|
6047
6098
|
}
|
|
6048
|
-
setNativeDialogOpen(false);
|
|
6049
6099
|
}
|
|
6050
6100
|
}
|
|
6051
6101
|
)
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useRef, createContext, useContext, useEffect, useCallback } from "react";
|
|
3
3
|
import ReactDOM, { createPortal } from "react-dom";
|
|
4
4
|
import { useFetchClient, useStrapiApp } from "@strapi/strapi/admin";
|
|
5
|
-
import { M as MaterialIcon } from "./index-
|
|
5
|
+
import { M as MaterialIcon } from "./index-Dc7AFLOj.mjs";
|
|
6
6
|
import cloneDeep from "lodash/cloneDeep";
|
|
7
7
|
const ROW_PRESETS = [
|
|
8
8
|
{
|
|
@@ -3778,9 +3778,33 @@ function mapStrapiFileToAsset(file, cacheBust) {
|
|
|
3778
3778
|
const sep = u.includes("?") ? "&" : "?";
|
|
3779
3779
|
return `${u}${sep}v=${Date.now()}`;
|
|
3780
3780
|
};
|
|
3781
|
+
const keepStandard = /* @__PURE__ */ new Set(["thumbnail", "small", "medium", "large"]);
|
|
3782
|
+
const compactFormats = {};
|
|
3783
|
+
let detectedOptimizedUrl = "";
|
|
3784
|
+
if (file?.formats && typeof file.formats === "object") {
|
|
3785
|
+
for (const [k, fmt] of Object.entries(file.formats)) {
|
|
3786
|
+
if (!fmt || typeof fmt !== "object" || typeof fmt.url !== "string" || !fmt.url) continue;
|
|
3787
|
+
if (!keepStandard.has(k) && !k.startsWith("ci_")) continue;
|
|
3788
|
+
compactFormats[k] = {
|
|
3789
|
+
url: fmt.url,
|
|
3790
|
+
...fmt.width ? { width: Number(fmt.width) } : {},
|
|
3791
|
+
...fmt.height ? { height: Number(fmt.height) } : {},
|
|
3792
|
+
...fmt.mime ? { mime: String(fmt.mime) } : {},
|
|
3793
|
+
...fmt.size ? { size: Number(fmt.size) } : {}
|
|
3794
|
+
};
|
|
3795
|
+
if (k.startsWith("ci_auto_") && !detectedOptimizedUrl) {
|
|
3796
|
+
detectedOptimizedUrl = fmt.url;
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3781
3800
|
const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
|
|
3782
|
-
const
|
|
3801
|
+
const rawMasterUrl = file.url || "";
|
|
3802
|
+
const finalUrl = appendBust(rawMasterUrl);
|
|
3783
3803
|
return {
|
|
3804
|
+
...file.id !== void 0 ? { id: file.id } : {},
|
|
3805
|
+
...file.hash ? { hash: file.hash } : {},
|
|
3806
|
+
original_url: rawMasterUrl,
|
|
3807
|
+
...detectedOptimizedUrl ? { optimized_url: appendBust(detectedOptimizedUrl) } : {},
|
|
3784
3808
|
target_url: finalUrl,
|
|
3785
3809
|
url: finalUrl,
|
|
3786
3810
|
filename: file.name || file.filename || "media",
|
|
@@ -3789,7 +3813,8 @@ function mapStrapiFileToAsset(file, cacheBust) {
|
|
|
3789
3813
|
width: file.width || void 0,
|
|
3790
3814
|
height: file.height || void 0,
|
|
3791
3815
|
caption: file.caption || file.alternativeText || "",
|
|
3792
|
-
srcset: srcset || void 0
|
|
3816
|
+
srcset: srcset || void 0,
|
|
3817
|
+
...Object.keys(compactFormats).length > 0 ? { formats: compactFormats } : {}
|
|
3793
3818
|
};
|
|
3794
3819
|
}
|
|
3795
3820
|
const ASPECT_PRESETS = [
|
|
@@ -3926,15 +3951,56 @@ const StrapiMediaPicker = ({
|
|
|
3926
3951
|
setModalOpen(true);
|
|
3927
3952
|
loadLibrary().finally(() => setLoading(false));
|
|
3928
3953
|
};
|
|
3954
|
+
const isRasterCandidate = (asset) => {
|
|
3955
|
+
if (!asset) return false;
|
|
3956
|
+
const m = String(asset.mime_type || "").toLowerCase();
|
|
3957
|
+
const u = String(asset.original_url || asset.url || asset.target_url || "").split("?")[0].toLowerCase();
|
|
3958
|
+
if (m.includes("svg") || m.includes("gif") || m.startsWith("video/") || m.startsWith("audio/") || m.startsWith("application/")) {
|
|
3959
|
+
return false;
|
|
3960
|
+
}
|
|
3961
|
+
if (/\.(svg|gif|mp4|webm|mov|pdf|docx?|xlsx?|pptx?|zip)$/i.test(u)) return false;
|
|
3962
|
+
return m.startsWith("image/") || /\.(jpe?g|png|webp|avif|tiff?|bmp)$/i.test(u);
|
|
3963
|
+
};
|
|
3964
|
+
const emitSingleAsset = (asset) => {
|
|
3965
|
+
onChange(asset);
|
|
3966
|
+
if (asset && asset.id && isRasterCandidate(asset) && !asset.optimized_url) {
|
|
3967
|
+
post("/content-input/media/optimize", { asset }).then((res) => {
|
|
3968
|
+
const enriched = res?.data?.data || res?.data;
|
|
3969
|
+
if (enriched && (enriched.optimized_url || enriched.formats)) {
|
|
3970
|
+
onChange(enriched);
|
|
3971
|
+
}
|
|
3972
|
+
}).catch(() => {
|
|
3973
|
+
});
|
|
3974
|
+
}
|
|
3975
|
+
};
|
|
3976
|
+
const emitMultipleAssets = async (assets) => {
|
|
3977
|
+
if (!assets || assets.length === 0) return;
|
|
3978
|
+
let finalAssets = assets;
|
|
3979
|
+
if (assets.some((a) => a.id && isRasterCandidate(a))) {
|
|
3980
|
+
try {
|
|
3981
|
+
const res = await post("/content-input/media/optimize", { assets });
|
|
3982
|
+
const enrichedList = res?.data?.data || res?.data;
|
|
3983
|
+
if (Array.isArray(enrichedList) && enrichedList.length === assets.length) {
|
|
3984
|
+
finalAssets = enrichedList;
|
|
3985
|
+
}
|
|
3986
|
+
} catch {
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
if (onSelectMultiple) {
|
|
3990
|
+
onSelectMultiple(finalAssets);
|
|
3991
|
+
} else {
|
|
3992
|
+
finalAssets.forEach((a) => onChange(a));
|
|
3993
|
+
}
|
|
3994
|
+
};
|
|
3929
3995
|
const handleOpenCropCurrent = async (e) => {
|
|
3930
3996
|
e.preventDefault();
|
|
3931
3997
|
e.stopPropagation();
|
|
3932
|
-
const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
|
|
3933
|
-
if (!currentUrl) return;
|
|
3998
|
+
const currentUrl = (value?.original_url || value?.target_url || value?.url || "").split("?")[0];
|
|
3999
|
+
if (!currentUrl && !value?.id) return;
|
|
3934
4000
|
setModalOpen(true);
|
|
3935
4001
|
const loaded = await loadLibrary();
|
|
3936
4002
|
const match = loaded.find(
|
|
3937
|
-
(f) => f.url && f.url.split("?")[0] === currentUrl || f.url && currentUrl.endsWith(f.url.split("?")[0]) || value?.filename && f.name === value.filename
|
|
4003
|
+
(f) => value?.id !== void 0 && Number(f.id) === Number(value.id) || value?.hash && f.hash === value.hash || f.url && currentUrl && f.url.split("?")[0] === currentUrl || f.url && currentUrl && currentUrl.endsWith(f.url.split("?")[0]) || value?.filename && f.name === value.filename
|
|
3938
4004
|
);
|
|
3939
4005
|
if (match) {
|
|
3940
4006
|
openEditorForFile(match, "crop");
|
|
@@ -3953,13 +4019,9 @@ const StrapiMediaPicker = ({
|
|
|
3953
4019
|
const handleConfirmMultiple = () => {
|
|
3954
4020
|
if (selectedFiles.length === 0) return;
|
|
3955
4021
|
const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
|
|
3956
|
-
if (onSelectMultiple) {
|
|
3957
|
-
onSelectMultiple(assets);
|
|
3958
|
-
} else {
|
|
3959
|
-
assets.forEach((asset) => onChange(asset));
|
|
3960
|
-
}
|
|
3961
4022
|
setSelectedFiles([]);
|
|
3962
4023
|
setModalOpen(false);
|
|
4024
|
+
void emitMultipleAssets(assets);
|
|
3963
4025
|
};
|
|
3964
4026
|
const handleFileUpload = async (e) => {
|
|
3965
4027
|
const inputFiles = e.target.files;
|
|
@@ -3980,19 +4042,15 @@ const StrapiMediaPicker = ({
|
|
|
3980
4042
|
if (!modalOpen) {
|
|
3981
4043
|
if (multiple) {
|
|
3982
4044
|
const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
|
|
3983
|
-
|
|
3984
|
-
onSelectMultiple(assets);
|
|
3985
|
-
} else {
|
|
3986
|
-
assets.forEach((a) => onChange(a));
|
|
3987
|
-
}
|
|
4045
|
+
await emitMultipleAssets(assets);
|
|
3988
4046
|
} else {
|
|
3989
|
-
|
|
4047
|
+
emitSingleAsset(mapStrapiFileToAsset(uploadedList[0]));
|
|
3990
4048
|
}
|
|
3991
4049
|
} else if (multiple) {
|
|
3992
4050
|
setSelectedFiles((prev) => [...prev, ...uploadedList]);
|
|
3993
4051
|
} else {
|
|
3994
|
-
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
3995
4052
|
setModalOpen(false);
|
|
4053
|
+
emitSingleAsset(mapStrapiFileToAsset(uploadedList[0]));
|
|
3996
4054
|
}
|
|
3997
4055
|
}
|
|
3998
4056
|
} catch {
|
|
@@ -5614,21 +5672,17 @@ const StrapiMediaPicker = ({
|
|
|
5614
5672
|
if (multiple) {
|
|
5615
5673
|
toggleFileSelection(file);
|
|
5616
5674
|
} else {
|
|
5617
|
-
onChange(mapStrapiFileToAsset(file));
|
|
5618
5675
|
setModalOpen(false);
|
|
5676
|
+
emitSingleAsset(mapStrapiFileToAsset(file));
|
|
5619
5677
|
}
|
|
5620
5678
|
},
|
|
5621
5679
|
onDoubleClick: () => {
|
|
5622
5680
|
if (multiple) {
|
|
5623
5681
|
const asset = mapStrapiFileToAsset(file);
|
|
5624
5682
|
const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
|
|
5625
|
-
if (onSelectMultiple) {
|
|
5626
|
-
onSelectMultiple(listToCommit);
|
|
5627
|
-
} else {
|
|
5628
|
-
listToCommit.forEach((a) => onChange(a));
|
|
5629
|
-
}
|
|
5630
5683
|
setSelectedFiles([]);
|
|
5631
5684
|
setModalOpen(false);
|
|
5685
|
+
void emitMultipleAssets(listToCommit);
|
|
5632
5686
|
}
|
|
5633
5687
|
},
|
|
5634
5688
|
style: {
|
|
@@ -6029,19 +6083,15 @@ const StrapiMediaPicker = ({
|
|
|
6029
6083
|
multiple,
|
|
6030
6084
|
onClose: () => setNativeDialogOpen(false),
|
|
6031
6085
|
onSelectAssets: (selectedAssets) => {
|
|
6086
|
+
setNativeDialogOpen(false);
|
|
6032
6087
|
if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
|
|
6033
6088
|
const mapped = selectedAssets.map((f) => mapStrapiFileToAsset(f));
|
|
6034
6089
|
if (multiple) {
|
|
6035
|
-
|
|
6036
|
-
onSelectMultiple(mapped);
|
|
6037
|
-
} else {
|
|
6038
|
-
mapped.forEach((asset) => onChange(asset));
|
|
6039
|
-
}
|
|
6090
|
+
void emitMultipleAssets(mapped);
|
|
6040
6091
|
} else {
|
|
6041
|
-
|
|
6092
|
+
emitSingleAsset(mapped[0]);
|
|
6042
6093
|
}
|
|
6043
6094
|
}
|
|
6044
|
-
setNativeDialogOpen(false);
|
|
6045
6095
|
}
|
|
6046
6096
|
}
|
|
6047
6097
|
)
|
|
@@ -153,7 +153,7 @@ const index = {
|
|
|
153
153
|
},
|
|
154
154
|
icon: PluginIcon,
|
|
155
155
|
components: {
|
|
156
|
-
Input: async () => import("./ContentInputField-
|
|
156
|
+
Input: async () => import("./ContentInputField-BrtpTCDd.mjs").then((mod) => ({
|
|
157
157
|
default: mod.ContentInputField
|
|
158
158
|
}))
|
|
159
159
|
},
|
|
@@ -188,7 +188,7 @@ const index = {
|
|
|
188
188
|
defaultMessage: "ContentInput Hub"
|
|
189
189
|
},
|
|
190
190
|
permissions: [],
|
|
191
|
-
Component: () => import("./AnalyticsHubPage-
|
|
191
|
+
Component: () => import("./AnalyticsHubPage-DUj3D2kA.mjs").then((mod) => ({
|
|
192
192
|
default: mod.AnalyticsHubPage
|
|
193
193
|
})),
|
|
194
194
|
position: 7
|
|
@@ -156,7 +156,7 @@ const index = {
|
|
|
156
156
|
},
|
|
157
157
|
icon: PluginIcon,
|
|
158
158
|
components: {
|
|
159
|
-
Input: async () => Promise.resolve().then(() => require("./ContentInputField-
|
|
159
|
+
Input: async () => Promise.resolve().then(() => require("./ContentInputField-CQFQxxgm.js")).then((mod) => ({
|
|
160
160
|
default: mod.ContentInputField
|
|
161
161
|
}))
|
|
162
162
|
},
|
|
@@ -191,7 +191,7 @@ const index = {
|
|
|
191
191
|
defaultMessage: "ContentInput Hub"
|
|
192
192
|
},
|
|
193
193
|
permissions: [],
|
|
194
|
-
Component: () => Promise.resolve().then(() => require("./AnalyticsHubPage-
|
|
194
|
+
Component: () => Promise.resolve().then(() => require("./AnalyticsHubPage-B1_chQkG.js")).then((mod) => ({
|
|
195
195
|
default: mod.AnalyticsHubPage
|
|
196
196
|
})),
|
|
197
197
|
position: 7
|
package/dist/admin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-i0NfSYto.js");
|
|
4
4
|
require("react");
|
|
5
5
|
exports.default = index.index;
|
package/dist/admin/index.mjs
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CIImageSettingsValue {
|
|
3
|
+
process?: '' | 'auto' | 'fit' | 'widen' | 'none' | 'no-process' | string;
|
|
4
|
+
cWidth?: number;
|
|
5
|
+
cHeight?: number;
|
|
6
|
+
quality?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface CIImageSettingsControlProps {
|
|
9
|
+
value?: CIImageSettingsValue | null;
|
|
10
|
+
onChange: (next: CIImageSettingsValue) => void;
|
|
11
|
+
locale?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
defaultWidth?: number;
|
|
14
|
+
defaultHeight?: number;
|
|
15
|
+
compact?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const CIImageSettingsControl: React.FC<CIImageSettingsControlProps>;
|
|
@@ -33,6 +33,7 @@ export interface HeroSliderLayer {
|
|
|
33
33
|
parallax?: number;
|
|
34
34
|
image?: CIMediaAsset | null;
|
|
35
35
|
imageWidth?: string;
|
|
36
|
+
imageSettings?: Record<string, any>;
|
|
36
37
|
buttons?: Array<{
|
|
37
38
|
id: string;
|
|
38
39
|
label: Record<string, string> | string;
|
|
@@ -59,10 +60,12 @@ export interface HeroSlideItem {
|
|
|
59
60
|
deviceVisibility?: HeroSlideDeviceVisibility;
|
|
60
61
|
bgType: 'image' | 'gradient' | 'video';
|
|
61
62
|
bgImage?: CIMediaAsset | null;
|
|
63
|
+
imageSettings?: Record<string, any>;
|
|
62
64
|
bgGradient?: string;
|
|
63
65
|
bgVideoUrl?: string;
|
|
64
66
|
mobileBgType?: 'inherit' | 'image' | 'gradient' | 'video';
|
|
65
67
|
mobileBgImage?: CIMediaAsset | null;
|
|
68
|
+
mobileImageSettings?: Record<string, any>;
|
|
66
69
|
mobileBgGradient?: string;
|
|
67
70
|
mobileBgVideoUrl?: string;
|
|
68
71
|
aspectRatios?: {
|
|
@@ -14,6 +14,7 @@ export declare function extractResponsiveProp(lp: Record<string, any> | undefine
|
|
|
14
14
|
export declare function setResponsiveProp(lp: Record<string, any> | undefined, baseKey: string, bpIndex: number, value: string | null, camelKey?: string): Record<string, any>;
|
|
15
15
|
export declare function rowCanvasClasses(row?: Partial<CIRowNode>): string[];
|
|
16
16
|
export declare function blockCanvasClasses(block?: Partial<CIBlockNode>): string[];
|
|
17
|
+
export declare function resolveCanvasMediaUrl(assetOrUrl: any, imageSettings?: Record<string, any> | null): string;
|
|
17
18
|
export declare function nodeCanvasStyles(node: {
|
|
18
19
|
styleOptions?: Record<string, any>;
|
|
19
20
|
bgImage?: any;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export type CIDeviceKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
3
|
export type BreakpointKey = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | CIDeviceKey;
|
|
4
|
+
export interface CIMediaFormatEntry {
|
|
5
|
+
url: string;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
mime?: string;
|
|
9
|
+
size?: number;
|
|
10
|
+
}
|
|
4
11
|
export interface CIMediaAsset {
|
|
12
|
+
id?: number | string;
|
|
13
|
+
hash?: string;
|
|
5
14
|
target_url: string;
|
|
6
15
|
url?: string;
|
|
16
|
+
original_url?: string;
|
|
17
|
+
optimized_url?: string;
|
|
7
18
|
filename?: string;
|
|
8
19
|
mime_type?: string;
|
|
9
20
|
size?: number;
|
|
@@ -12,6 +23,7 @@ export interface CIMediaAsset {
|
|
|
12
23
|
caption?: string;
|
|
13
24
|
alt?: string;
|
|
14
25
|
srcset?: any;
|
|
26
|
+
formats?: Record<string, CIMediaFormatEntry>;
|
|
15
27
|
}
|
|
16
28
|
export interface CIParallaxOptions {
|
|
17
29
|
type: 'scroll' | 'scale' | 'opacity' | 'scroll-opacity' | 'scale-opacity';
|