@ozguraltan/strapi-content-input 1.0.6 → 1.0.8
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/admin/{ContentInputField-D6rlm6Te.mjs → ContentInputField-CKTOutN-.mjs} +416 -59
- package/dist/admin/{ContentInputField-BM2WS_KZ.js → ContentInputField-CLuL3TFr.js} +416 -59
- package/dist/admin/{index-BA2XyNVO.mjs → index-BIwC3VPC.mjs} +1 -1
- package/dist/admin/{index-IuCWhUHI.js → index-DV4pLrQl.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/widgets/StrapiMediaPicker.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactDom = require("react-dom");
|
|
6
6
|
const cloneDeep = require("lodash/cloneDeep");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-DV4pLrQl.js");
|
|
8
8
|
const admin = require("@strapi/strapi/admin");
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
@@ -850,7 +850,8 @@ const translations = {
|
|
|
850
850
|
gridGallery: "Grid Gallery",
|
|
851
851
|
galleryDisplayType: "Gallery Display Type",
|
|
852
852
|
galleryImages: "Gallery Images",
|
|
853
|
-
addGalleryImage: "+ Add Image",
|
|
853
|
+
addGalleryImage: "+ Add Image(s)",
|
|
854
|
+
clearAllImages: "Clear All",
|
|
854
855
|
noGalleryImages: "No images added to this gallery yet.",
|
|
855
856
|
popupOnOnClick: "Open in Lightbox Popup on Click",
|
|
856
857
|
imageProcess: "Image Processing",
|
|
@@ -979,17 +980,37 @@ const translations = {
|
|
|
979
980
|
// Media Picker
|
|
980
981
|
selectImage: "Select Image",
|
|
981
982
|
selectMedia: "Select Media",
|
|
983
|
+
selectMultipleMedia: "Select Images",
|
|
982
984
|
removeImage: "Remove Image",
|
|
983
985
|
mediaUrlPlaceholder: "Image URL or choose from Media Library...",
|
|
984
986
|
mediaLibraryTitle: "Strapi Media Library",
|
|
985
987
|
filesCount: "files",
|
|
986
988
|
refresh: "Refresh",
|
|
987
989
|
uploading: "Uploading...",
|
|
988
|
-
uploadNewFile: "Upload New File",
|
|
990
|
+
uploadNewFile: "Upload New File(s)",
|
|
989
991
|
searchFilesPlaceholder: "Search by file name or extension...",
|
|
990
992
|
loadingMediaFiles: "Loading media files...",
|
|
991
993
|
noMediaFilesFound: "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
992
|
-
selectedBadge: "SELECTED"
|
|
994
|
+
selectedBadge: "SELECTED",
|
|
995
|
+
multiSelectHint: "Click multiple images to select them in order",
|
|
996
|
+
selectedCountLabel: "selected",
|
|
997
|
+
selectAllVisible: "Select All",
|
|
998
|
+
clearSelection: "Clear Selection",
|
|
999
|
+
addSelectedMedia: "Add Selected",
|
|
1000
|
+
"media.selectImage": "Select Image",
|
|
1001
|
+
"media.selectMedia": "Select Media",
|
|
1002
|
+
"media.selectMultipleMedia": "Select Images",
|
|
1003
|
+
"media.removeImage": "Remove Image",
|
|
1004
|
+
"media.urlPlaceholder": "Image URL or choose from Media Library...",
|
|
1005
|
+
"media.libraryTitle": "Strapi Media Library",
|
|
1006
|
+
"media.filesCount": "files",
|
|
1007
|
+
"media.refresh": "Refresh",
|
|
1008
|
+
"media.uploading": "Uploading...",
|
|
1009
|
+
"media.uploadNew": "Upload New File(s)",
|
|
1010
|
+
"media.searchPlaceholder": "Search by file name or extension...",
|
|
1011
|
+
"media.loadingFiles": "Loading media files...",
|
|
1012
|
+
"media.noMatchingFiles": "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
1013
|
+
"media.selectedBadge": "SELECTED"
|
|
993
1014
|
},
|
|
994
1015
|
tr: {
|
|
995
1016
|
// Core entities & actions
|
|
@@ -1163,7 +1184,8 @@ const translations = {
|
|
|
1163
1184
|
gridGallery: "Grid (Izgara Galeri)",
|
|
1164
1185
|
galleryDisplayType: "Galeri Gösterim Tipi",
|
|
1165
1186
|
galleryImages: "Galeri Görselleri",
|
|
1166
|
-
addGalleryImage: "+ Görsel Ekle",
|
|
1187
|
+
addGalleryImage: "+ Görsel(ler) Ekle",
|
|
1188
|
+
clearAllImages: "Tümünü Temizle",
|
|
1167
1189
|
noGalleryImages: "Henüz galeriye görsel eklenmedi.",
|
|
1168
1190
|
popupOnOnClick: "Tıklandığında Pop-up (Lightbox) Olarak Büyüt",
|
|
1169
1191
|
imageProcess: "Görsel İşleme (Image Process)",
|
|
@@ -1292,17 +1314,37 @@ const translations = {
|
|
|
1292
1314
|
// Media Picker
|
|
1293
1315
|
selectImage: "Görsel Seç",
|
|
1294
1316
|
selectMedia: "Medya Seç",
|
|
1317
|
+
selectMultipleMedia: "Çoklu Görsel Seç",
|
|
1295
1318
|
removeImage: "Görseli Kaldır",
|
|
1296
1319
|
mediaUrlPlaceholder: "Görsel URL veya Medya Kütüphanesi...",
|
|
1297
1320
|
mediaLibraryTitle: "Strapi Medya Kütüphanesi",
|
|
1298
1321
|
filesCount: "dosya",
|
|
1299
1322
|
refresh: "Yenile",
|
|
1300
1323
|
uploading: "Yükleniyor...",
|
|
1301
|
-
uploadNewFile: "Yeni Dosya Yükle",
|
|
1324
|
+
uploadNewFile: "Yeni Dosya(lar) Yükle",
|
|
1302
1325
|
searchFilesPlaceholder: "Dosya adı veya uzantı ara...",
|
|
1303
1326
|
loadingMediaFiles: "Medya dosyaları yükleniyor...",
|
|
1304
1327
|
noMediaFilesFound: "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1305
|
-
selectedBadge: "SEÇİLİ"
|
|
1328
|
+
selectedBadge: "SEÇİLİ",
|
|
1329
|
+
multiSelectHint: "Birden fazla görseli sırayla seçmek için üzerine tıklayın",
|
|
1330
|
+
selectedCountLabel: "seçildi",
|
|
1331
|
+
selectAllVisible: "Tümünü Seç",
|
|
1332
|
+
clearSelection: "Seçimi Temizle",
|
|
1333
|
+
addSelectedMedia: "Seçilenleri Ekle",
|
|
1334
|
+
"media.selectImage": "Görsel Seç",
|
|
1335
|
+
"media.selectMedia": "Medya Seç",
|
|
1336
|
+
"media.selectMultipleMedia": "Çoklu Görsel Seç",
|
|
1337
|
+
"media.removeImage": "Görseli Kaldır",
|
|
1338
|
+
"media.urlPlaceholder": "Görsel URL veya Medya Kütüphanesi...",
|
|
1339
|
+
"media.libraryTitle": "Strapi Medya Kütüphanesi",
|
|
1340
|
+
"media.filesCount": "dosya",
|
|
1341
|
+
"media.refresh": "Yenile",
|
|
1342
|
+
"media.uploading": "Yükleniyor...",
|
|
1343
|
+
"media.uploadNew": "Yeni Dosya(lar) Yükle",
|
|
1344
|
+
"media.searchPlaceholder": "Dosya adı veya uzantı ara...",
|
|
1345
|
+
"media.loadingFiles": "Medya dosyaları yükleniyor...",
|
|
1346
|
+
"media.noMatchingFiles": "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1347
|
+
"media.selectedBadge": "SEÇİLİ"
|
|
1306
1348
|
}
|
|
1307
1349
|
};
|
|
1308
1350
|
function createTranslator(locale = "en") {
|
|
@@ -2894,6 +2936,7 @@ const VENodeToolbar = ({
|
|
|
2894
2936
|
onDragStart,
|
|
2895
2937
|
onDragEnd
|
|
2896
2938
|
}) => {
|
|
2939
|
+
const { t } = useEditorTranslator();
|
|
2897
2940
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2898
2941
|
"div",
|
|
2899
2942
|
{
|
|
@@ -2903,7 +2946,7 @@ const VENodeToolbar = ({
|
|
|
2903
2946
|
onDragEnd,
|
|
2904
2947
|
onClick: (e) => e.stopPropagation(),
|
|
2905
2948
|
style: { cursor: onDragStart ? "grab" : "default" },
|
|
2906
|
-
title: "
|
|
2949
|
+
title: t("field.dragToReorderRow", "Drag to reorder"),
|
|
2907
2950
|
children: [
|
|
2908
2951
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2909
2952
|
"span",
|
|
@@ -2926,7 +2969,7 @@ const VENodeToolbar = ({
|
|
|
2926
2969
|
{
|
|
2927
2970
|
type: "button",
|
|
2928
2971
|
className: "ve-node-toolbar__btn",
|
|
2929
|
-
title: "
|
|
2972
|
+
title: `${t("contextMenu.moveUp", "Move Up")} (Alt+↑)`,
|
|
2930
2973
|
onClick: onMoveUp,
|
|
2931
2974
|
children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "arrow_upward", size: 13, color: "#fff" })
|
|
2932
2975
|
}
|
|
@@ -2936,7 +2979,7 @@ const VENodeToolbar = ({
|
|
|
2936
2979
|
{
|
|
2937
2980
|
type: "button",
|
|
2938
2981
|
className: "ve-node-toolbar__btn",
|
|
2939
|
-
title: "
|
|
2982
|
+
title: `${t("contextMenu.moveDown", "Move Down")} (Alt+↓)`,
|
|
2940
2983
|
onClick: onMoveDown,
|
|
2941
2984
|
children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "arrow_downward", size: 13, color: "#fff" })
|
|
2942
2985
|
}
|
|
@@ -2946,7 +2989,7 @@ const VENodeToolbar = ({
|
|
|
2946
2989
|
{
|
|
2947
2990
|
type: "button",
|
|
2948
2991
|
className: "ve-node-toolbar__btn",
|
|
2949
|
-
title: "
|
|
2992
|
+
title: t("common.settings", "Settings"),
|
|
2950
2993
|
onClick: onSettings,
|
|
2951
2994
|
children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "tune", size: 13, color: "#fff" })
|
|
2952
2995
|
}
|
|
@@ -2956,7 +2999,7 @@ const VENodeToolbar = ({
|
|
|
2956
2999
|
{
|
|
2957
3000
|
type: "button",
|
|
2958
3001
|
className: "ve-node-toolbar__btn",
|
|
2959
|
-
title: "
|
|
3002
|
+
title: `${t("common.duplicate", "Duplicate")} (Ctrl+D)`,
|
|
2960
3003
|
onClick: onDuplicate,
|
|
2961
3004
|
children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "content_copy", size: 13, color: "#fff" })
|
|
2962
3005
|
}
|
|
@@ -2966,7 +3009,7 @@ const VENodeToolbar = ({
|
|
|
2966
3009
|
{
|
|
2967
3010
|
type: "button",
|
|
2968
3011
|
className: "ve-node-toolbar__btn ve-node-toolbar__btn--danger",
|
|
2969
|
-
title: "
|
|
3012
|
+
title: `${t("common.delete", "Delete")} (Delete)`,
|
|
2970
3013
|
onClick: onDelete,
|
|
2971
3014
|
children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete_outline", size: 13, color: "#fff" })
|
|
2972
3015
|
}
|
|
@@ -10090,6 +10133,7 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10090
10133
|
type: "button",
|
|
10091
10134
|
draggable: true,
|
|
10092
10135
|
onDragStart: (e) => {
|
|
10136
|
+
e.stopPropagation();
|
|
10093
10137
|
const payload = {
|
|
10094
10138
|
type: "new-row-preset",
|
|
10095
10139
|
cols: preset.cols
|
|
@@ -10098,7 +10142,10 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10098
10142
|
e.dataTransfer.effectAllowed = "copy";
|
|
10099
10143
|
e.dataTransfer.setData("application/x-ci-dnd", JSON.stringify(payload));
|
|
10100
10144
|
},
|
|
10101
|
-
onDragEnd: () =>
|
|
10145
|
+
onDragEnd: (e) => {
|
|
10146
|
+
e.stopPropagation();
|
|
10147
|
+
editor.setDragItem(null);
|
|
10148
|
+
},
|
|
10102
10149
|
onClick: () => editor.addRowPreset(preset.cols),
|
|
10103
10150
|
title: `${presetLabel} (${t("leftPanel.clickOrDrag", "Click or drag onto canvas")})`,
|
|
10104
10151
|
style: {
|
|
@@ -10170,6 +10217,7 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10170
10217
|
type: "button",
|
|
10171
10218
|
draggable: true,
|
|
10172
10219
|
onDragStart: (e) => {
|
|
10220
|
+
e.stopPropagation();
|
|
10173
10221
|
const payload = {
|
|
10174
10222
|
type: "new-widget",
|
|
10175
10223
|
widgetId: w.id
|
|
@@ -10178,7 +10226,10 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10178
10226
|
e.dataTransfer.effectAllowed = "copy";
|
|
10179
10227
|
e.dataTransfer.setData("application/x-ci-dnd", JSON.stringify(payload));
|
|
10180
10228
|
},
|
|
10181
|
-
onDragEnd: () =>
|
|
10229
|
+
onDragEnd: (e) => {
|
|
10230
|
+
e.stopPropagation();
|
|
10231
|
+
editor.setDragItem(null);
|
|
10232
|
+
},
|
|
10182
10233
|
onClick: () => handleWidgetQuickAdd(w.id),
|
|
10183
10234
|
title: `${wDesc} (${t("leftPanel.clickOrDragBlock", "Click or drag into block")})`,
|
|
10184
10235
|
style: {
|
|
@@ -10251,10 +10302,13 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10251
10302
|
draggable: true,
|
|
10252
10303
|
onDragStart: (e) => {
|
|
10253
10304
|
e.stopPropagation();
|
|
10254
|
-
|
|
10305
|
+
const payload = { type: "row", rowIndex: rIdx };
|
|
10306
|
+
editor.setDragItem(payload);
|
|
10255
10307
|
e.dataTransfer.effectAllowed = "move";
|
|
10308
|
+
e.dataTransfer.setData("application/x-ci-dnd", JSON.stringify(payload));
|
|
10256
10309
|
},
|
|
10257
|
-
onDragEnd: () => {
|
|
10310
|
+
onDragEnd: (e) => {
|
|
10311
|
+
e.stopPropagation();
|
|
10258
10312
|
editor.setDragItem(null);
|
|
10259
10313
|
setLayerDropTarget(null);
|
|
10260
10314
|
},
|
|
@@ -10337,14 +10391,17 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10337
10391
|
draggable: true,
|
|
10338
10392
|
onDragStart: (e) => {
|
|
10339
10393
|
e.stopPropagation();
|
|
10340
|
-
|
|
10394
|
+
const payload = {
|
|
10341
10395
|
type: "block",
|
|
10342
10396
|
rowIndex: rIdx,
|
|
10343
10397
|
blockIndex: bIdx
|
|
10344
|
-
}
|
|
10398
|
+
};
|
|
10399
|
+
editor.setDragItem(payload);
|
|
10345
10400
|
e.dataTransfer.effectAllowed = "move";
|
|
10401
|
+
e.dataTransfer.setData("application/x-ci-dnd", JSON.stringify(payload));
|
|
10346
10402
|
},
|
|
10347
|
-
onDragEnd: () => {
|
|
10403
|
+
onDragEnd: (e) => {
|
|
10404
|
+
e.stopPropagation();
|
|
10348
10405
|
editor.setDragItem(null);
|
|
10349
10406
|
setLayerDropTarget(null);
|
|
10350
10407
|
},
|
|
@@ -10435,15 +10492,18 @@ const VELeftPanel = ({ width = 280 }) => {
|
|
|
10435
10492
|
draggable: true,
|
|
10436
10493
|
onDragStart: (e) => {
|
|
10437
10494
|
e.stopPropagation();
|
|
10438
|
-
|
|
10495
|
+
const payload = {
|
|
10439
10496
|
type: "widget",
|
|
10440
10497
|
rowIndex: rIdx,
|
|
10441
10498
|
blockIndex: bIdx,
|
|
10442
10499
|
widgetIndex: wIdx
|
|
10443
|
-
}
|
|
10500
|
+
};
|
|
10501
|
+
editor.setDragItem(payload);
|
|
10444
10502
|
e.dataTransfer.effectAllowed = "move";
|
|
10503
|
+
e.dataTransfer.setData("application/x-ci-dnd", JSON.stringify(payload));
|
|
10445
10504
|
},
|
|
10446
|
-
onDragEnd: () => {
|
|
10505
|
+
onDragEnd: (e) => {
|
|
10506
|
+
e.stopPropagation();
|
|
10447
10507
|
editor.setDragItem(null);
|
|
10448
10508
|
setLayerDropTarget(null);
|
|
10449
10509
|
},
|
|
@@ -10925,6 +10985,31 @@ const VECanvas = () => {
|
|
|
10925
10985
|
textAlign: "center"
|
|
10926
10986
|
},
|
|
10927
10987
|
onClick: (e) => e.stopPropagation(),
|
|
10988
|
+
onDragOver: (e) => {
|
|
10989
|
+
const d = editor.dragItem;
|
|
10990
|
+
if (!d || d.type !== "new-row-preset" && d.type !== "new-widget") return;
|
|
10991
|
+
e.preventDefault();
|
|
10992
|
+
e.stopPropagation();
|
|
10993
|
+
e.dataTransfer.dropEffect = "copy";
|
|
10994
|
+
},
|
|
10995
|
+
onDrop: (e) => {
|
|
10996
|
+
const d = editor.dragItem;
|
|
10997
|
+
if (!d) return;
|
|
10998
|
+
if (d.type === "new-row-preset") {
|
|
10999
|
+
e.preventDefault();
|
|
11000
|
+
e.stopPropagation();
|
|
11001
|
+
editor.setDragItem(null);
|
|
11002
|
+
editor.addRowPreset(d.cols);
|
|
11003
|
+
} else if (d.type === "new-widget") {
|
|
11004
|
+
e.preventDefault();
|
|
11005
|
+
e.stopPropagation();
|
|
11006
|
+
editor.setDragItem(null);
|
|
11007
|
+
editor.addRowPreset([[12, 12, 12, 12, 12]]);
|
|
11008
|
+
setTimeout(() => {
|
|
11009
|
+
editor.addWidget(0, 0, d.widgetId);
|
|
11010
|
+
}, 0);
|
|
11011
|
+
}
|
|
11012
|
+
},
|
|
10928
11013
|
children: [
|
|
10929
11014
|
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "dashboard_customize", size: 38, color: "#2669a0" }),
|
|
10930
11015
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11388,6 +11473,9 @@ const UnitInput = ({
|
|
|
11388
11473
|
)
|
|
11389
11474
|
] });
|
|
11390
11475
|
};
|
|
11476
|
+
function getFileKey(file) {
|
|
11477
|
+
return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
|
|
11478
|
+
}
|
|
11391
11479
|
function mapStrapiFileToAsset(file) {
|
|
11392
11480
|
const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${f.url} ${f.width}w`).join(", ") : "";
|
|
11393
11481
|
return {
|
|
@@ -11405,12 +11493,15 @@ function mapStrapiFileToAsset(file) {
|
|
|
11405
11493
|
const StrapiMediaPicker = ({
|
|
11406
11494
|
value,
|
|
11407
11495
|
onChange,
|
|
11408
|
-
label
|
|
11496
|
+
label,
|
|
11497
|
+
multiple = false,
|
|
11498
|
+
onSelectMultiple
|
|
11409
11499
|
}) => {
|
|
11410
11500
|
const { t } = useEditorTranslator();
|
|
11411
11501
|
const { get, post } = admin.useFetchClient();
|
|
11412
11502
|
const [modalOpen, setModalOpen] = React.useState(false);
|
|
11413
11503
|
const [files, setFiles] = React.useState([]);
|
|
11504
|
+
const [selectedFiles, setSelectedFiles] = React.useState([]);
|
|
11414
11505
|
const [loading, setLoading] = React.useState(false);
|
|
11415
11506
|
const [uploading, setUploading] = React.useState(false);
|
|
11416
11507
|
const [search, setSearch] = React.useState("");
|
|
@@ -11448,24 +11539,57 @@ const StrapiMediaPicker = ({
|
|
|
11448
11539
|
const handleOpenModal = (e) => {
|
|
11449
11540
|
e.preventDefault();
|
|
11450
11541
|
e.stopPropagation();
|
|
11542
|
+
setSelectedFiles([]);
|
|
11451
11543
|
setModalOpen(true);
|
|
11452
11544
|
loadLibrary().finally(() => setLoading(false));
|
|
11453
11545
|
};
|
|
11546
|
+
const toggleFileSelection = (file) => {
|
|
11547
|
+
const key = getFileKey(file);
|
|
11548
|
+
setSelectedFiles((prev) => {
|
|
11549
|
+
const exists = prev.some((f) => getFileKey(f) === key);
|
|
11550
|
+
if (exists) {
|
|
11551
|
+
return prev.filter((f) => getFileKey(f) !== key);
|
|
11552
|
+
}
|
|
11553
|
+
return [...prev, file];
|
|
11554
|
+
});
|
|
11555
|
+
};
|
|
11556
|
+
const handleConfirmMultiple = () => {
|
|
11557
|
+
if (selectedFiles.length === 0) return;
|
|
11558
|
+
const assets = selectedFiles.map(mapStrapiFileToAsset);
|
|
11559
|
+
if (onSelectMultiple) {
|
|
11560
|
+
onSelectMultiple(assets);
|
|
11561
|
+
} else {
|
|
11562
|
+
assets.forEach((asset) => onChange(asset));
|
|
11563
|
+
}
|
|
11564
|
+
setSelectedFiles([]);
|
|
11565
|
+
setModalOpen(false);
|
|
11566
|
+
};
|
|
11454
11567
|
const handleFileUpload = async (e) => {
|
|
11455
|
-
const
|
|
11456
|
-
if (!
|
|
11568
|
+
const inputFiles = e.target.files;
|
|
11569
|
+
if (!inputFiles || inputFiles.length === 0) return;
|
|
11457
11570
|
setUploading(true);
|
|
11458
11571
|
try {
|
|
11459
11572
|
const formData = new FormData();
|
|
11460
|
-
for (let i = 0; i <
|
|
11461
|
-
formData.append("files",
|
|
11573
|
+
for (let i = 0; i < inputFiles.length; i++) {
|
|
11574
|
+
formData.append("files", inputFiles[i]);
|
|
11462
11575
|
}
|
|
11463
11576
|
const res = await post("/upload", formData);
|
|
11464
11577
|
const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
|
|
11465
11578
|
await loadLibrary();
|
|
11466
11579
|
if (uploadedList.length > 0) {
|
|
11467
|
-
|
|
11468
|
-
|
|
11580
|
+
if (multiple) {
|
|
11581
|
+
const assets = uploadedList.map(mapStrapiFileToAsset);
|
|
11582
|
+
if (onSelectMultiple) {
|
|
11583
|
+
onSelectMultiple(assets);
|
|
11584
|
+
} else {
|
|
11585
|
+
assets.forEach((a) => onChange(a));
|
|
11586
|
+
}
|
|
11587
|
+
setSelectedFiles([]);
|
|
11588
|
+
setModalOpen(false);
|
|
11589
|
+
} else {
|
|
11590
|
+
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
11591
|
+
setModalOpen(false);
|
|
11592
|
+
}
|
|
11469
11593
|
}
|
|
11470
11594
|
} catch {
|
|
11471
11595
|
} finally {
|
|
@@ -11477,7 +11601,25 @@ const StrapiMediaPicker = ({
|
|
|
11477
11601
|
const handleUrlApply = () => {
|
|
11478
11602
|
const trimmed = urlInput.trim();
|
|
11479
11603
|
if (!trimmed) {
|
|
11480
|
-
if (value) onChange(null);
|
|
11604
|
+
if (!multiple && value) onChange(null);
|
|
11605
|
+
return;
|
|
11606
|
+
}
|
|
11607
|
+
if (multiple) {
|
|
11608
|
+
const parts = trimmed.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean);
|
|
11609
|
+
if (parts.length === 0) return;
|
|
11610
|
+
const assets = parts.map((u) => ({
|
|
11611
|
+
target_url: u,
|
|
11612
|
+
url: u,
|
|
11613
|
+
filename: u.split("/").pop() || "external-image",
|
|
11614
|
+
mime_type: "image/jpeg",
|
|
11615
|
+
caption: ""
|
|
11616
|
+
}));
|
|
11617
|
+
if (onSelectMultiple) {
|
|
11618
|
+
onSelectMultiple(assets);
|
|
11619
|
+
} else {
|
|
11620
|
+
assets.forEach((a) => onChange(a));
|
|
11621
|
+
}
|
|
11622
|
+
setUrlInput("");
|
|
11481
11623
|
return;
|
|
11482
11624
|
}
|
|
11483
11625
|
if (trimmed === (value?.target_url || value?.url || "")) return;
|
|
@@ -11621,8 +11763,8 @@ const StrapiMediaPicker = ({
|
|
|
11621
11763
|
whiteSpace: "nowrap"
|
|
11622
11764
|
},
|
|
11623
11765
|
children: [
|
|
11624
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "image", size: 15, color: "#fff" }),
|
|
11625
|
-
t("media.selectMedia", "Select Media")
|
|
11766
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: multiple ? "collections" : "image", size: 15, color: "#fff" }),
|
|
11767
|
+
multiple ? t("media.selectMultipleMedia", "Select Images") : t("media.selectMedia", "Select Media")
|
|
11626
11768
|
]
|
|
11627
11769
|
}
|
|
11628
11770
|
)
|
|
@@ -11766,22 +11908,82 @@ const StrapiMediaPicker = ({
|
|
|
11766
11908
|
]
|
|
11767
11909
|
}
|
|
11768
11910
|
),
|
|
11769
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11770
|
-
"
|
|
11911
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11912
|
+
"div",
|
|
11771
11913
|
{
|
|
11772
|
-
type: "text",
|
|
11773
|
-
value: search,
|
|
11774
|
-
onChange: (e) => setSearch(e.target.value),
|
|
11775
|
-
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
11776
11914
|
style: {
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
}
|
|
11915
|
+
padding: "10px 18px",
|
|
11916
|
+
borderBottom: "1px solid #f1f5f9",
|
|
11917
|
+
display: "flex",
|
|
11918
|
+
alignItems: "center",
|
|
11919
|
+
gap: 8
|
|
11920
|
+
},
|
|
11921
|
+
children: [
|
|
11922
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11923
|
+
"input",
|
|
11924
|
+
{
|
|
11925
|
+
type: "text",
|
|
11926
|
+
value: search,
|
|
11927
|
+
onChange: (e) => setSearch(e.target.value),
|
|
11928
|
+
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
11929
|
+
style: {
|
|
11930
|
+
flex: 1,
|
|
11931
|
+
padding: "7px 10px",
|
|
11932
|
+
fontSize: 12,
|
|
11933
|
+
border: "1px solid #cbd5e1",
|
|
11934
|
+
borderRadius: 5
|
|
11935
|
+
}
|
|
11936
|
+
}
|
|
11937
|
+
),
|
|
11938
|
+
multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11939
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11940
|
+
"button",
|
|
11941
|
+
{
|
|
11942
|
+
type: "button",
|
|
11943
|
+
onClick: () => {
|
|
11944
|
+
const existingKeys = new Set(selectedFiles.map(getFileKey));
|
|
11945
|
+
const additions = filteredFiles.filter(
|
|
11946
|
+
(f) => !existingKeys.has(getFileKey(f))
|
|
11947
|
+
);
|
|
11948
|
+
setSelectedFiles([...selectedFiles, ...additions]);
|
|
11949
|
+
},
|
|
11950
|
+
style: {
|
|
11951
|
+
padding: "6px 10px",
|
|
11952
|
+
fontSize: 11,
|
|
11953
|
+
fontWeight: 600,
|
|
11954
|
+
border: "1px solid #cbd5e1",
|
|
11955
|
+
borderRadius: 5,
|
|
11956
|
+
background: "#ffffff",
|
|
11957
|
+
color: "#334155",
|
|
11958
|
+
cursor: "pointer",
|
|
11959
|
+
whiteSpace: "nowrap"
|
|
11960
|
+
},
|
|
11961
|
+
children: t("selectAllVisible", "Select All")
|
|
11962
|
+
}
|
|
11963
|
+
),
|
|
11964
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11965
|
+
"button",
|
|
11966
|
+
{
|
|
11967
|
+
type: "button",
|
|
11968
|
+
onClick: () => setSelectedFiles([]),
|
|
11969
|
+
style: {
|
|
11970
|
+
padding: "6px 10px",
|
|
11971
|
+
fontSize: 11,
|
|
11972
|
+
fontWeight: 600,
|
|
11973
|
+
border: "1px solid #fecaca",
|
|
11974
|
+
borderRadius: 5,
|
|
11975
|
+
background: "#fef2f2",
|
|
11976
|
+
color: "#dc2626",
|
|
11977
|
+
cursor: "pointer",
|
|
11978
|
+
whiteSpace: "nowrap"
|
|
11979
|
+
},
|
|
11980
|
+
children: t("clearSelection", "Clear Selection")
|
|
11981
|
+
}
|
|
11982
|
+
)
|
|
11983
|
+
] })
|
|
11984
|
+
]
|
|
11783
11985
|
}
|
|
11784
|
-
)
|
|
11986
|
+
),
|
|
11785
11987
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11786
11988
|
"div",
|
|
11787
11989
|
{
|
|
@@ -11806,14 +12008,36 @@ const StrapiMediaPicker = ({
|
|
|
11806
12008
|
gap: 12
|
|
11807
12009
|
},
|
|
11808
12010
|
children: filteredFiles.map((file) => {
|
|
11809
|
-
const
|
|
12011
|
+
const fileKey = getFileKey(file);
|
|
12012
|
+
const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
|
|
12013
|
+
const isMultiSelected = multiIndex !== -1;
|
|
12014
|
+
const isCurrent = multiple ? isMultiSelected : Boolean(
|
|
12015
|
+
previewUrl && (file.url === previewUrl || file.name === value?.filename)
|
|
12016
|
+
);
|
|
11810
12017
|
const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
|
|
11811
12018
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11812
12019
|
"div",
|
|
11813
12020
|
{
|
|
11814
12021
|
onClick: () => {
|
|
11815
|
-
|
|
11816
|
-
|
|
12022
|
+
if (multiple) {
|
|
12023
|
+
toggleFileSelection(file);
|
|
12024
|
+
} else {
|
|
12025
|
+
onChange(mapStrapiFileToAsset(file));
|
|
12026
|
+
setModalOpen(false);
|
|
12027
|
+
}
|
|
12028
|
+
},
|
|
12029
|
+
onDoubleClick: () => {
|
|
12030
|
+
if (multiple) {
|
|
12031
|
+
const asset = mapStrapiFileToAsset(file);
|
|
12032
|
+
const listToCommit = selectedFiles.length > 0 ? selectedFiles.map(mapStrapiFileToAsset) : [asset];
|
|
12033
|
+
if (onSelectMultiple) {
|
|
12034
|
+
onSelectMultiple(listToCommit);
|
|
12035
|
+
} else {
|
|
12036
|
+
listToCommit.forEach((a) => onChange(a));
|
|
12037
|
+
}
|
|
12038
|
+
setSelectedFiles([]);
|
|
12039
|
+
setModalOpen(false);
|
|
12040
|
+
}
|
|
11817
12041
|
},
|
|
11818
12042
|
style: {
|
|
11819
12043
|
border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
|
|
@@ -11821,7 +12045,8 @@ const StrapiMediaPicker = ({
|
|
|
11821
12045
|
overflow: "hidden",
|
|
11822
12046
|
cursor: "pointer",
|
|
11823
12047
|
background: isCurrent ? "#eff6ff" : "#fff",
|
|
11824
|
-
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)"
|
|
12048
|
+
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
|
|
12049
|
+
userSelect: "none"
|
|
11825
12050
|
},
|
|
11826
12051
|
children: [
|
|
11827
12052
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11844,7 +12069,30 @@ const StrapiMediaPicker = ({
|
|
|
11844
12069
|
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
11845
12070
|
}
|
|
11846
12071
|
) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
|
|
11847
|
-
|
|
12072
|
+
multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12073
|
+
"span",
|
|
12074
|
+
{
|
|
12075
|
+
style: {
|
|
12076
|
+
position: "absolute",
|
|
12077
|
+
top: 6,
|
|
12078
|
+
left: 6,
|
|
12079
|
+
minWidth: 22,
|
|
12080
|
+
height: 22,
|
|
12081
|
+
padding: isMultiSelected ? "0 6px" : 0,
|
|
12082
|
+
borderRadius: 11,
|
|
12083
|
+
background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.88)",
|
|
12084
|
+
border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
|
|
12085
|
+
color: "#ffffff",
|
|
12086
|
+
fontSize: 10,
|
|
12087
|
+
fontWeight: 700,
|
|
12088
|
+
display: "inline-flex",
|
|
12089
|
+
alignItems: "center",
|
|
12090
|
+
justifyContent: "center",
|
|
12091
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
12092
|
+
},
|
|
12093
|
+
children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
|
|
12094
|
+
}
|
|
12095
|
+
) : isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11848
12096
|
"span",
|
|
11849
12097
|
{
|
|
11850
12098
|
style: {
|
|
@@ -11906,11 +12154,84 @@ const StrapiMediaPicker = ({
|
|
|
11906
12154
|
] })
|
|
11907
12155
|
]
|
|
11908
12156
|
},
|
|
11909
|
-
|
|
12157
|
+
fileKey
|
|
11910
12158
|
);
|
|
11911
12159
|
})
|
|
11912
12160
|
}
|
|
11913
|
-
) })
|
|
12161
|
+
) }),
|
|
12162
|
+
multiple && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12163
|
+
"div",
|
|
12164
|
+
{
|
|
12165
|
+
style: {
|
|
12166
|
+
display: "flex",
|
|
12167
|
+
alignItems: "center",
|
|
12168
|
+
justifyContent: "space-between",
|
|
12169
|
+
padding: "12px 18px",
|
|
12170
|
+
borderTop: "1px solid #e2e8f0",
|
|
12171
|
+
background: "#f8fafc",
|
|
12172
|
+
gap: 12
|
|
12173
|
+
},
|
|
12174
|
+
children: [
|
|
12175
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: selectedFiles.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
|
|
12176
|
+
selectedFiles.length,
|
|
12177
|
+
" ",
|
|
12178
|
+
t("selectedCountLabel", "selected")
|
|
12179
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) }),
|
|
12180
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
12181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12182
|
+
"button",
|
|
12183
|
+
{
|
|
12184
|
+
type: "button",
|
|
12185
|
+
onClick: () => {
|
|
12186
|
+
setSelectedFiles([]);
|
|
12187
|
+
setModalOpen(false);
|
|
12188
|
+
},
|
|
12189
|
+
style: {
|
|
12190
|
+
padding: "7px 14px",
|
|
12191
|
+
fontSize: 12,
|
|
12192
|
+
fontWeight: 600,
|
|
12193
|
+
border: "1px solid #cbd5e1",
|
|
12194
|
+
borderRadius: 5,
|
|
12195
|
+
background: "#ffffff",
|
|
12196
|
+
color: "#475569",
|
|
12197
|
+
cursor: "pointer"
|
|
12198
|
+
},
|
|
12199
|
+
children: t("cancel", "Cancel")
|
|
12200
|
+
}
|
|
12201
|
+
),
|
|
12202
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12203
|
+
"button",
|
|
12204
|
+
{
|
|
12205
|
+
type: "button",
|
|
12206
|
+
disabled: selectedFiles.length === 0,
|
|
12207
|
+
onClick: handleConfirmMultiple,
|
|
12208
|
+
style: {
|
|
12209
|
+
display: "inline-flex",
|
|
12210
|
+
alignItems: "center",
|
|
12211
|
+
gap: 6,
|
|
12212
|
+
padding: "7px 16px",
|
|
12213
|
+
fontSize: 12,
|
|
12214
|
+
fontWeight: 700,
|
|
12215
|
+
border: "none",
|
|
12216
|
+
borderRadius: 5,
|
|
12217
|
+
background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
|
|
12218
|
+
color: "#ffffff",
|
|
12219
|
+
cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
|
|
12220
|
+
},
|
|
12221
|
+
children: [
|
|
12222
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
|
|
12223
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
12224
|
+
t("addSelectedMedia", "Add Selected"),
|
|
12225
|
+
" ",
|
|
12226
|
+
selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
|
|
12227
|
+
] })
|
|
12228
|
+
]
|
|
12229
|
+
}
|
|
12230
|
+
)
|
|
12231
|
+
] })
|
|
12232
|
+
]
|
|
12233
|
+
}
|
|
12234
|
+
)
|
|
11914
12235
|
]
|
|
11915
12236
|
}
|
|
11916
12237
|
)
|
|
@@ -13007,18 +13328,54 @@ const WidgetEditor = ({ widget, onChange }) => {
|
|
|
13007
13328
|
{
|
|
13008
13329
|
label: t("addGalleryImage"),
|
|
13009
13330
|
value: null,
|
|
13331
|
+
multiple: true,
|
|
13010
13332
|
onChange: (asset) => {
|
|
13011
13333
|
if (asset) updateData([...images, asset]);
|
|
13334
|
+
},
|
|
13335
|
+
onSelectMultiple: (newAssets) => {
|
|
13336
|
+
if (newAssets && newAssets.length > 0) {
|
|
13337
|
+
updateData([...images, ...newAssets]);
|
|
13338
|
+
}
|
|
13012
13339
|
}
|
|
13013
13340
|
}
|
|
13014
13341
|
) }),
|
|
13015
13342
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
13016
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13343
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13344
|
+
"div",
|
|
13345
|
+
{
|
|
13346
|
+
style: {
|
|
13347
|
+
display: "flex",
|
|
13348
|
+
alignItems: "center",
|
|
13349
|
+
justifyContent: "space-between",
|
|
13350
|
+
marginBottom: 4
|
|
13351
|
+
},
|
|
13352
|
+
children: [
|
|
13353
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: { ...labelStyle, marginBottom: 0 }, children: [
|
|
13354
|
+
t("galleryImages"),
|
|
13355
|
+
" (",
|
|
13356
|
+
images.length,
|
|
13357
|
+
")"
|
|
13358
|
+
] }),
|
|
13359
|
+
images.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13360
|
+
"button",
|
|
13361
|
+
{
|
|
13362
|
+
type: "button",
|
|
13363
|
+
onClick: () => updateData([]),
|
|
13364
|
+
style: {
|
|
13365
|
+
border: "none",
|
|
13366
|
+
background: "transparent",
|
|
13367
|
+
color: "#dc2626",
|
|
13368
|
+
fontSize: 11,
|
|
13369
|
+
fontWeight: 600,
|
|
13370
|
+
cursor: "pointer",
|
|
13371
|
+
padding: "2px 4px"
|
|
13372
|
+
},
|
|
13373
|
+
children: t("clearAllImages")
|
|
13374
|
+
}
|
|
13375
|
+
)
|
|
13376
|
+
]
|
|
13377
|
+
}
|
|
13378
|
+
),
|
|
13022
13379
|
images.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
13023
13380
|
"div",
|
|
13024
13381
|
{
|