@ozguraltan/strapi-content-input 1.0.7 → 1.0.9
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-D-oLSSaU.mjs → ContentInputField-CykwdQ1S.mjs} +1939 -261
- package/dist/admin/{ContentInputField-BKP5B-ap.js → ContentInputField-DTnK3agK.js} +1938 -260
- package/dist/admin/{index-DjfM5X8R.mjs → index-DzJ89qyO.mjs} +1 -1
- package/dist/admin/{index-CEOkAoB9.js → index-ysKdDQY1.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 +3 -1
- package/dist/server/index.js +486 -3
- package/dist/server/index.mjs +481 -3
- package/dist/server/src/controllers/ci-image.d.ts +32 -0
- package/dist/server/src/controllers/index.d.ts +9 -0
- package/dist/server/src/index.d.ts +30 -0
- package/dist/server/src/routes/index.d.ts +21 -0
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useState, useMemo, useRef, createContext, useContext, useEffect } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import cloneDeep from "lodash/cloneDeep";
|
|
5
|
-
import { M as MaterialIcon } from "./index-
|
|
6
|
-
import { useFetchClient } from "@strapi/strapi/admin";
|
|
5
|
+
import { M as MaterialIcon } from "./index-DzJ89qyO.mjs";
|
|
6
|
+
import { useFetchClient, useStrapiApp } from "@strapi/strapi/admin";
|
|
7
7
|
const ROW_PRESETS = [
|
|
8
8
|
{
|
|
9
9
|
id: "12",
|
|
@@ -845,7 +845,8 @@ const translations = {
|
|
|
845
845
|
gridGallery: "Grid Gallery",
|
|
846
846
|
galleryDisplayType: "Gallery Display Type",
|
|
847
847
|
galleryImages: "Gallery Images",
|
|
848
|
-
addGalleryImage: "+ Add Image",
|
|
848
|
+
addGalleryImage: "+ Add Image(s)",
|
|
849
|
+
clearAllImages: "Clear All",
|
|
849
850
|
noGalleryImages: "No images added to this gallery yet.",
|
|
850
851
|
popupOnOnClick: "Open in Lightbox Popup on Click",
|
|
851
852
|
imageProcess: "Image Processing",
|
|
@@ -974,17 +975,37 @@ const translations = {
|
|
|
974
975
|
// Media Picker
|
|
975
976
|
selectImage: "Select Image",
|
|
976
977
|
selectMedia: "Select Media",
|
|
978
|
+
selectMultipleMedia: "Select Images",
|
|
977
979
|
removeImage: "Remove Image",
|
|
978
980
|
mediaUrlPlaceholder: "Image URL or choose from Media Library...",
|
|
979
981
|
mediaLibraryTitle: "Strapi Media Library",
|
|
980
982
|
filesCount: "files",
|
|
981
983
|
refresh: "Refresh",
|
|
982
984
|
uploading: "Uploading...",
|
|
983
|
-
uploadNewFile: "Upload New File",
|
|
985
|
+
uploadNewFile: "Upload New File(s)",
|
|
984
986
|
searchFilesPlaceholder: "Search by file name or extension...",
|
|
985
987
|
loadingMediaFiles: "Loading media files...",
|
|
986
988
|
noMediaFilesFound: "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
987
|
-
selectedBadge: "SELECTED"
|
|
989
|
+
selectedBadge: "SELECTED",
|
|
990
|
+
multiSelectHint: "Click multiple images to select them in order",
|
|
991
|
+
selectedCountLabel: "selected",
|
|
992
|
+
selectAllVisible: "Select All",
|
|
993
|
+
clearSelection: "Clear Selection",
|
|
994
|
+
addSelectedMedia: "Add Selected",
|
|
995
|
+
"media.selectImage": "Select Image",
|
|
996
|
+
"media.selectMedia": "Select Media",
|
|
997
|
+
"media.selectMultipleMedia": "Select Images",
|
|
998
|
+
"media.removeImage": "Remove Image",
|
|
999
|
+
"media.urlPlaceholder": "Image URL or choose from Media Library...",
|
|
1000
|
+
"media.libraryTitle": "Strapi Media Library",
|
|
1001
|
+
"media.filesCount": "files",
|
|
1002
|
+
"media.refresh": "Refresh",
|
|
1003
|
+
"media.uploading": "Uploading...",
|
|
1004
|
+
"media.uploadNew": "Upload New File(s)",
|
|
1005
|
+
"media.searchPlaceholder": "Search by file name or extension...",
|
|
1006
|
+
"media.loadingFiles": "Loading media files...",
|
|
1007
|
+
"media.noMatchingFiles": "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
|
|
1008
|
+
"media.selectedBadge": "SELECTED"
|
|
988
1009
|
},
|
|
989
1010
|
tr: {
|
|
990
1011
|
// Core entities & actions
|
|
@@ -1158,7 +1179,8 @@ const translations = {
|
|
|
1158
1179
|
gridGallery: "Grid (Izgara Galeri)",
|
|
1159
1180
|
galleryDisplayType: "Galeri Gösterim Tipi",
|
|
1160
1181
|
galleryImages: "Galeri Görselleri",
|
|
1161
|
-
addGalleryImage: "+ Görsel Ekle",
|
|
1182
|
+
addGalleryImage: "+ Görsel(ler) Ekle",
|
|
1183
|
+
clearAllImages: "Tümünü Temizle",
|
|
1162
1184
|
noGalleryImages: "Henüz galeriye görsel eklenmedi.",
|
|
1163
1185
|
popupOnOnClick: "Tıklandığında Pop-up (Lightbox) Olarak Büyüt",
|
|
1164
1186
|
imageProcess: "Görsel İşleme (Image Process)",
|
|
@@ -1287,17 +1309,37 @@ const translations = {
|
|
|
1287
1309
|
// Media Picker
|
|
1288
1310
|
selectImage: "Görsel Seç",
|
|
1289
1311
|
selectMedia: "Medya Seç",
|
|
1312
|
+
selectMultipleMedia: "Çoklu Görsel Seç",
|
|
1290
1313
|
removeImage: "Görseli Kaldır",
|
|
1291
1314
|
mediaUrlPlaceholder: "Görsel URL veya Medya Kütüphanesi...",
|
|
1292
1315
|
mediaLibraryTitle: "Strapi Medya Kütüphanesi",
|
|
1293
1316
|
filesCount: "dosya",
|
|
1294
1317
|
refresh: "Yenile",
|
|
1295
1318
|
uploading: "Yükleniyor...",
|
|
1296
|
-
uploadNewFile: "Yeni Dosya Yükle",
|
|
1319
|
+
uploadNewFile: "Yeni Dosya(lar) Yükle",
|
|
1297
1320
|
searchFilesPlaceholder: "Dosya adı veya uzantı ara...",
|
|
1298
1321
|
loadingMediaFiles: "Medya dosyaları yükleniyor...",
|
|
1299
1322
|
noMediaFilesFound: "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1300
|
-
selectedBadge: "SEÇİLİ"
|
|
1323
|
+
selectedBadge: "SEÇİLİ",
|
|
1324
|
+
multiSelectHint: "Birden fazla görseli sırayla seçmek için üzerine tıklayın",
|
|
1325
|
+
selectedCountLabel: "seçildi",
|
|
1326
|
+
selectAllVisible: "Tümünü Seç",
|
|
1327
|
+
clearSelection: "Seçimi Temizle",
|
|
1328
|
+
addSelectedMedia: "Seçilenleri Ekle",
|
|
1329
|
+
"media.selectImage": "Görsel Seç",
|
|
1330
|
+
"media.selectMedia": "Medya Seç",
|
|
1331
|
+
"media.selectMultipleMedia": "Çoklu Görsel Seç",
|
|
1332
|
+
"media.removeImage": "Görseli Kaldır",
|
|
1333
|
+
"media.urlPlaceholder": "Görsel URL veya Medya Kütüphanesi...",
|
|
1334
|
+
"media.libraryTitle": "Strapi Medya Kütüphanesi",
|
|
1335
|
+
"media.filesCount": "dosya",
|
|
1336
|
+
"media.refresh": "Yenile",
|
|
1337
|
+
"media.uploading": "Yükleniyor...",
|
|
1338
|
+
"media.uploadNew": "Yeni Dosya(lar) Yükle",
|
|
1339
|
+
"media.searchPlaceholder": "Dosya adı veya uzantı ara...",
|
|
1340
|
+
"media.loadingFiles": "Medya dosyaları yükleniyor...",
|
|
1341
|
+
"media.noMatchingFiles": "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
|
|
1342
|
+
"media.selectedBadge": "SEÇİLİ"
|
|
1301
1343
|
}
|
|
1302
1344
|
};
|
|
1303
1345
|
function createTranslator(locale = "en") {
|
|
@@ -3141,6 +3183,9 @@ const RichHtmlEditor = ({
|
|
|
3141
3183
|
const tr = locale === "tr";
|
|
3142
3184
|
const effectivePlaceholder = placeholder || (tr ? "Metin içeriğinizi buraya yazın..." : "Type your text content here...");
|
|
3143
3185
|
const { get, post } = useFetchClient();
|
|
3186
|
+
const components = useStrapiApp("RichHtmlEditor", (state) => state.components);
|
|
3187
|
+
const NativeMediaLibraryDialog = components?.["media-library"];
|
|
3188
|
+
const [nativePickerOpen, setNativePickerOpen] = useState(false);
|
|
3144
3189
|
const [sourceMode, setSourceMode] = useState(false);
|
|
3145
3190
|
const editorRef = useRef(null);
|
|
3146
3191
|
const isFocusedRef = useRef(false);
|
|
@@ -3250,9 +3295,14 @@ const RichHtmlEditor = ({
|
|
|
3250
3295
|
setLinkDownload(false);
|
|
3251
3296
|
setLinkDownloadName("");
|
|
3252
3297
|
}
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3298
|
+
if (openWithMedia && NativeMediaLibraryDialog) {
|
|
3299
|
+
setShowMediaBrowser(false);
|
|
3300
|
+
setNativePickerOpen(true);
|
|
3301
|
+
} else {
|
|
3302
|
+
setShowMediaBrowser(openWithMedia);
|
|
3303
|
+
if (openWithMedia) {
|
|
3304
|
+
loadMediaLibrary();
|
|
3305
|
+
}
|
|
3256
3306
|
}
|
|
3257
3307
|
setLinkModalOpen(true);
|
|
3258
3308
|
};
|
|
@@ -3740,7 +3790,7 @@ const RichHtmlEditor = ({
|
|
|
3740
3790
|
position: "fixed",
|
|
3741
3791
|
inset: 0,
|
|
3742
3792
|
background: "rgba(15, 23, 42, 0.55)",
|
|
3743
|
-
zIndex:
|
|
3793
|
+
zIndex: 260,
|
|
3744
3794
|
display: "flex",
|
|
3745
3795
|
alignItems: "center",
|
|
3746
3796
|
justifyContent: "center",
|
|
@@ -3865,6 +3915,10 @@ const RichHtmlEditor = ({
|
|
|
3865
3915
|
{
|
|
3866
3916
|
type: "button",
|
|
3867
3917
|
onClick: () => {
|
|
3918
|
+
if (NativeMediaLibraryDialog) {
|
|
3919
|
+
setNativePickerOpen(true);
|
|
3920
|
+
return;
|
|
3921
|
+
}
|
|
3868
3922
|
const next = !showMediaBrowser;
|
|
3869
3923
|
setShowMediaBrowser(next);
|
|
3870
3924
|
if (next && mediaFiles.length === 0) {
|
|
@@ -4341,6 +4395,20 @@ const RichHtmlEditor = ({
|
|
|
4341
4395
|
}
|
|
4342
4396
|
),
|
|
4343
4397
|
document.body
|
|
4398
|
+
),
|
|
4399
|
+
nativePickerOpen && NativeMediaLibraryDialog && /* @__PURE__ */ jsx(
|
|
4400
|
+
NativeMediaLibraryDialog,
|
|
4401
|
+
{
|
|
4402
|
+
allowedTypes: ["files", "images", "videos", "audios"],
|
|
4403
|
+
multiple: false,
|
|
4404
|
+
onClose: () => setNativePickerOpen(false),
|
|
4405
|
+
onSelectAssets: (selectedAssets) => {
|
|
4406
|
+
if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
|
|
4407
|
+
selectMediaFileForLink(selectedAssets[0]);
|
|
4408
|
+
}
|
|
4409
|
+
setNativePickerOpen(false);
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4344
4412
|
)
|
|
4345
4413
|
]
|
|
4346
4414
|
}
|
|
@@ -5311,7 +5379,7 @@ const TabAccordionEditor = ({ widget, onChange }) => {
|
|
|
5311
5379
|
style: {
|
|
5312
5380
|
position: "fixed",
|
|
5313
5381
|
inset: 0,
|
|
5314
|
-
zIndex:
|
|
5382
|
+
zIndex: 215,
|
|
5315
5383
|
background: "rgba(15, 23, 42, 0.65)",
|
|
5316
5384
|
display: "flex",
|
|
5317
5385
|
alignItems: "center",
|
|
@@ -6863,6 +6931,24 @@ function resolveYoutubeVideoId(raw) {
|
|
|
6863
6931
|
if (extracted === "dQw4w9WgXcQ") return "M7lc1UVf-VE";
|
|
6864
6932
|
return extracted;
|
|
6865
6933
|
}
|
|
6934
|
+
function buildSharpImageUrl(rawUrl, imageSettings) {
|
|
6935
|
+
if (!rawUrl) return "";
|
|
6936
|
+
if (!imageSettings || !imageSettings.process) return rawUrl;
|
|
6937
|
+
const proc = String(imageSettings.process).toLowerCase();
|
|
6938
|
+
if (proc !== "fit" && proc !== "widen") return rawUrl;
|
|
6939
|
+
const w = Number(imageSettings.cWidth) || 0;
|
|
6940
|
+
const h = Number(imageSettings.cHeight) || 0;
|
|
6941
|
+
if (w <= 0 && h <= 0) return rawUrl;
|
|
6942
|
+
if (rawUrl.includes("/api/content-input/image") || rawUrl.includes("/content-input/image")) {
|
|
6943
|
+
return rawUrl;
|
|
6944
|
+
}
|
|
6945
|
+
const params = new URLSearchParams();
|
|
6946
|
+
params.set("src", rawUrl);
|
|
6947
|
+
params.set("process", proc);
|
|
6948
|
+
if (w > 0) params.set("w", String(w));
|
|
6949
|
+
if (proc === "fit" && h > 0) params.set("h", String(h));
|
|
6950
|
+
return `/api/content-input/image?${params.toString()}`;
|
|
6951
|
+
}
|
|
6866
6952
|
const WidgetPreview = ({
|
|
6867
6953
|
widget,
|
|
6868
6954
|
isEditing,
|
|
@@ -7112,7 +7198,7 @@ const WidgetPreview = ({
|
|
|
7112
7198
|
const imgProcess = imageSettings.process || "";
|
|
7113
7199
|
const customW = Number(imageSettings.cWidth) || 0;
|
|
7114
7200
|
const customH = Number(imageSettings.cHeight) || 0;
|
|
7115
|
-
const imgObjectFit =
|
|
7201
|
+
const imgObjectFit = "cover";
|
|
7116
7202
|
if (images.length === 0) {
|
|
7117
7203
|
return /* @__PURE__ */ jsxs(
|
|
7118
7204
|
"div",
|
|
@@ -7150,7 +7236,7 @@ const WidgetPreview = ({
|
|
|
7150
7236
|
position: "fixed",
|
|
7151
7237
|
inset: 0,
|
|
7152
7238
|
background: "rgba(15, 23, 42, 0.86)",
|
|
7153
|
-
zIndex:
|
|
7239
|
+
zIndex: 280,
|
|
7154
7240
|
display: "flex",
|
|
7155
7241
|
alignItems: "center",
|
|
7156
7242
|
justifyContent: "center",
|
|
@@ -7343,7 +7429,7 @@ const WidgetPreview = ({
|
|
|
7343
7429
|
children: /* @__PURE__ */ jsx(
|
|
7344
7430
|
"img",
|
|
7345
7431
|
{
|
|
7346
|
-
src: img.target_url || img.url,
|
|
7432
|
+
src: buildSharpImageUrl(img.target_url || img.url, imageSettings),
|
|
7347
7433
|
alt: img.caption || `${t("widgets.gallery.label")} ${i + 1}`,
|
|
7348
7434
|
style: {
|
|
7349
7435
|
width: "100%",
|
|
@@ -7373,18 +7459,17 @@ const WidgetPreview = ({
|
|
|
7373
7459
|
const itemIndex = (safeIdx + offset) % images.length;
|
|
7374
7460
|
return { item: images[itemIndex], index: itemIndex };
|
|
7375
7461
|
});
|
|
7376
|
-
const
|
|
7462
|
+
const slideAspectRatio = imgProcess === "fit" && customW > 0 && customH > 0 ? `${customW} / ${customH}` : slidesPerView > 1 ? "4 / 3" : "16 / 9";
|
|
7377
7463
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7378
7464
|
/* @__PURE__ */ jsxs(
|
|
7379
7465
|
"div",
|
|
7380
7466
|
{
|
|
7381
7467
|
style: {
|
|
7382
7468
|
position: "relative",
|
|
7469
|
+
width: "100%",
|
|
7383
7470
|
borderRadius: 6,
|
|
7384
7471
|
overflow: "hidden",
|
|
7385
7472
|
background: "#0f172a",
|
|
7386
|
-
height: containerHeight,
|
|
7387
|
-
maxWidth: customW > 0 ? `${customW}px` : void 0,
|
|
7388
7473
|
cursor: grabCursor ? "grab" : isPopupEnabled ? "zoom-in" : "default"
|
|
7389
7474
|
},
|
|
7390
7475
|
children: [
|
|
@@ -7393,15 +7478,15 @@ const WidgetPreview = ({
|
|
|
7393
7478
|
{
|
|
7394
7479
|
style: {
|
|
7395
7480
|
display: "grid",
|
|
7396
|
-
gridTemplateColumns: `repeat(${slidesPerView}, 1fr)`,
|
|
7481
|
+
gridTemplateColumns: `repeat(${slidesPerView}, minmax(0, 1fr))`,
|
|
7397
7482
|
gap: spaceBetween,
|
|
7398
7483
|
width: "100%",
|
|
7399
|
-
height: "100%",
|
|
7400
7484
|
padding: slidesPerView > 1 && spaceBetween > 0 ? 4 : 0,
|
|
7401
7485
|
boxSizing: "border-box"
|
|
7402
7486
|
},
|
|
7403
7487
|
children: visibleSlides.map(({ item, index }) => {
|
|
7404
|
-
const
|
|
7488
|
+
const rawSlideUrl = item?.target_url || item?.url || "";
|
|
7489
|
+
const slideUrl = buildSharpImageUrl(rawSlideUrl, imageSettings);
|
|
7405
7490
|
return /* @__PURE__ */ jsx(
|
|
7406
7491
|
"div",
|
|
7407
7492
|
{
|
|
@@ -7414,7 +7499,7 @@ const WidgetPreview = ({
|
|
|
7414
7499
|
style: {
|
|
7415
7500
|
position: "relative",
|
|
7416
7501
|
width: "100%",
|
|
7417
|
-
|
|
7502
|
+
aspectRatio: slideAspectRatio,
|
|
7418
7503
|
overflow: "hidden",
|
|
7419
7504
|
borderRadius: slidesPerView > 1 ? 4 : 0,
|
|
7420
7505
|
background: "#1e293b"
|
|
@@ -7849,7 +7934,7 @@ const WidgetPreview = ({
|
|
|
7849
7934
|
position: "fixed",
|
|
7850
7935
|
inset: 0,
|
|
7851
7936
|
background: "rgba(15, 23, 42, 0.82)",
|
|
7852
|
-
zIndex:
|
|
7937
|
+
zIndex: 280,
|
|
7853
7938
|
display: "flex",
|
|
7854
7939
|
alignItems: "center",
|
|
7855
7940
|
justifyContent: "center",
|
|
@@ -11426,11 +11511,20 @@ const UnitInput = ({
|
|
|
11426
11511
|
)
|
|
11427
11512
|
] });
|
|
11428
11513
|
};
|
|
11429
|
-
function
|
|
11430
|
-
|
|
11514
|
+
function getFileKey(file) {
|
|
11515
|
+
return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
|
|
11516
|
+
}
|
|
11517
|
+
function mapStrapiFileToAsset(file, cacheBust) {
|
|
11518
|
+
const appendBust = (u) => {
|
|
11519
|
+
if (!u || !cacheBust) return u;
|
|
11520
|
+
const sep = u.includes("?") ? "&" : "?";
|
|
11521
|
+
return `${u}${sep}v=${Date.now()}`;
|
|
11522
|
+
};
|
|
11523
|
+
const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
|
|
11524
|
+
const finalUrl = appendBust(file.url || "");
|
|
11431
11525
|
return {
|
|
11432
|
-
target_url:
|
|
11433
|
-
url:
|
|
11526
|
+
target_url: finalUrl,
|
|
11527
|
+
url: finalUrl,
|
|
11434
11528
|
filename: file.name || file.filename || "media",
|
|
11435
11529
|
mime_type: file.mime || file.mime_type || "application/octet-stream",
|
|
11436
11530
|
size: file.size || 0,
|
|
@@ -11440,20 +11534,58 @@ function mapStrapiFileToAsset(file) {
|
|
|
11440
11534
|
srcset: srcset || void 0
|
|
11441
11535
|
};
|
|
11442
11536
|
}
|
|
11537
|
+
const ASPECT_PRESETS = [
|
|
11538
|
+
{ label: "Free", ratio: null },
|
|
11539
|
+
{ label: "1:1", ratio: 1 },
|
|
11540
|
+
{ label: "16:9", ratio: 16 / 9 },
|
|
11541
|
+
{ label: "4:3", ratio: 4 / 3 },
|
|
11542
|
+
{ label: "3:2", ratio: 3 / 2 },
|
|
11543
|
+
{ label: "4:5", ratio: 4 / 5 }
|
|
11544
|
+
];
|
|
11443
11545
|
const StrapiMediaPicker = ({
|
|
11444
11546
|
value,
|
|
11445
11547
|
onChange,
|
|
11446
|
-
label
|
|
11548
|
+
label,
|
|
11549
|
+
multiple = false,
|
|
11550
|
+
onSelectMultiple
|
|
11447
11551
|
}) => {
|
|
11448
|
-
const { t } = useEditorTranslator();
|
|
11449
|
-
const
|
|
11552
|
+
const { t, locale } = useEditorTranslator();
|
|
11553
|
+
const tr = locale === "tr";
|
|
11554
|
+
const { get, post, put, del } = useFetchClient();
|
|
11450
11555
|
const [modalOpen, setModalOpen] = useState(false);
|
|
11451
11556
|
const [files, setFiles] = useState([]);
|
|
11557
|
+
const [folders, setFolders] = useState([]);
|
|
11558
|
+
const [currentFolderId, setCurrentFolderId] = useState(null);
|
|
11559
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
11452
11560
|
const [loading, setLoading] = useState(false);
|
|
11453
11561
|
const [uploading, setUploading] = useState(false);
|
|
11454
11562
|
const [search, setSearch] = useState("");
|
|
11455
|
-
const [
|
|
11563
|
+
const [typeFilter, setTypeFilter] = useState("all");
|
|
11564
|
+
const [sortBy, setSortBy] = useState(
|
|
11565
|
+
"newest"
|
|
11566
|
+
);
|
|
11567
|
+
const [creatingFolder, setCreatingFolder] = useState(false);
|
|
11568
|
+
const [newFolderName, setNewFolderName] = useState("");
|
|
11569
|
+
const [editingFile, setEditingFile] = useState(null);
|
|
11570
|
+
const [editTab, setEditTab] = useState("crop");
|
|
11571
|
+
const [editName, setEditName] = useState("");
|
|
11572
|
+
const [editAlt, setEditAlt] = useState("");
|
|
11573
|
+
const [editCaption, setEditCaption] = useState("");
|
|
11574
|
+
const [editFolderId, setEditFolderId] = useState(null);
|
|
11575
|
+
const [savingDetails, setSavingDetails] = useState(false);
|
|
11576
|
+
const [naturalSize, setNaturalSize] = useState({
|
|
11577
|
+
width: 0,
|
|
11578
|
+
height: 0
|
|
11579
|
+
});
|
|
11580
|
+
const [cropRect, setCropRect] = useState({ x: 0, y: 0, width: 100, height: 100 });
|
|
11581
|
+
const [cropRotate, setCropRotate] = useState(0);
|
|
11582
|
+
const [aspectPreset, setAspectPreset] = useState(null);
|
|
11583
|
+
const [croppingBusy, setCroppingBusy] = useState(false);
|
|
11584
|
+
const [cropError, setCropError] = useState(null);
|
|
11585
|
+
const cropImgRef = useRef(null);
|
|
11586
|
+
const cropBoxRef = useRef(null);
|
|
11456
11587
|
const fileInputRef = useRef(null);
|
|
11588
|
+
const [urlInput, setUrlInput] = useState(value?.target_url || value?.url || "");
|
|
11457
11589
|
const effectiveLabel = label !== void 0 ? label : t("media.selectImage", "Select Image");
|
|
11458
11590
|
useEffect(() => {
|
|
11459
11591
|
setUrlInput(value?.target_url || value?.url || "");
|
|
@@ -11463,47 +11595,125 @@ const StrapiMediaPicker = ({
|
|
|
11463
11595
|
try {
|
|
11464
11596
|
const res = await get("/content-input/media");
|
|
11465
11597
|
const primaryList = Array.isArray(res?.data?.data) ? res.data.data : Array.isArray(res?.data) ? res.data : null;
|
|
11598
|
+
const folderList = Array.isArray(res?.data?.folders) ? res.data.folders : [];
|
|
11599
|
+
if (folderList.length > 0) {
|
|
11600
|
+
setFolders(folderList);
|
|
11601
|
+
}
|
|
11466
11602
|
if (primaryList) {
|
|
11467
11603
|
setFiles(primaryList);
|
|
11468
|
-
|
|
11604
|
+
setLoading(false);
|
|
11605
|
+
return primaryList;
|
|
11469
11606
|
}
|
|
11470
11607
|
} catch {
|
|
11471
11608
|
}
|
|
11472
11609
|
try {
|
|
11473
|
-
const fallbackRes = await get("/upload/files?pageSize=
|
|
11610
|
+
const fallbackRes = await get("/upload/files?pageSize=200&page=1");
|
|
11474
11611
|
const fallbackList = Array.isArray(fallbackRes?.data?.results) ? fallbackRes.data.results : Array.isArray(fallbackRes?.data) ? fallbackRes.data : [];
|
|
11475
11612
|
setFiles(fallbackList);
|
|
11613
|
+
return fallbackList;
|
|
11476
11614
|
} catch {
|
|
11477
11615
|
setFiles([]);
|
|
11616
|
+
return [];
|
|
11478
11617
|
} finally {
|
|
11479
11618
|
setLoading(false);
|
|
11480
11619
|
}
|
|
11481
11620
|
};
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11621
|
+
const openEditorForFile = (file, initialTab = "crop") => {
|
|
11622
|
+
setEditingFile(file);
|
|
11623
|
+
setEditTab(file?.mime?.startsWith("image/") ? initialTab : "details");
|
|
11624
|
+
setEditName(file?.name || "");
|
|
11625
|
+
setEditAlt(file?.alternativeText || "");
|
|
11626
|
+
setEditCaption(file?.caption || "");
|
|
11627
|
+
setEditFolderId(file?.folder?.id ?? file?.folder ?? null);
|
|
11628
|
+
setCropRotate(0);
|
|
11629
|
+
setAspectPreset(null);
|
|
11630
|
+
setCropError(null);
|
|
11631
|
+
const w = Number(file?.width) || 800;
|
|
11632
|
+
const h = Number(file?.height) || 600;
|
|
11633
|
+
setNaturalSize({ width: w, height: h });
|
|
11634
|
+
setCropRect({
|
|
11635
|
+
x: 0,
|
|
11636
|
+
y: 0,
|
|
11637
|
+
width: w,
|
|
11638
|
+
height: h
|
|
11639
|
+
});
|
|
11640
|
+
};
|
|
11486
11641
|
const handleOpenModal = (e) => {
|
|
11487
11642
|
e.preventDefault();
|
|
11488
11643
|
e.stopPropagation();
|
|
11644
|
+
setSelectedFiles([]);
|
|
11645
|
+
setEditingFile(null);
|
|
11489
11646
|
setModalOpen(true);
|
|
11490
11647
|
loadLibrary().finally(() => setLoading(false));
|
|
11491
11648
|
};
|
|
11649
|
+
const handleOpenCropCurrent = async (e) => {
|
|
11650
|
+
e.preventDefault();
|
|
11651
|
+
e.stopPropagation();
|
|
11652
|
+
const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
|
|
11653
|
+
if (!currentUrl) return;
|
|
11654
|
+
setModalOpen(true);
|
|
11655
|
+
const loaded = files.length > 0 ? files : await loadLibrary();
|
|
11656
|
+
const match = loaded.find(
|
|
11657
|
+
(f) => f.url && f.url.split("?")[0] === currentUrl || value?.filename && f.name === value.filename
|
|
11658
|
+
);
|
|
11659
|
+
if (match) {
|
|
11660
|
+
openEditorForFile(match, "crop");
|
|
11661
|
+
}
|
|
11662
|
+
};
|
|
11663
|
+
const toggleFileSelection = (file) => {
|
|
11664
|
+
const key = getFileKey(file);
|
|
11665
|
+
setSelectedFiles((prev) => {
|
|
11666
|
+
const exists = prev.some((f) => getFileKey(f) === key);
|
|
11667
|
+
if (exists) {
|
|
11668
|
+
return prev.filter((f) => getFileKey(f) !== key);
|
|
11669
|
+
}
|
|
11670
|
+
return [...prev, file];
|
|
11671
|
+
});
|
|
11672
|
+
};
|
|
11673
|
+
const handleConfirmMultiple = () => {
|
|
11674
|
+
if (selectedFiles.length === 0) return;
|
|
11675
|
+
const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
|
|
11676
|
+
if (onSelectMultiple) {
|
|
11677
|
+
onSelectMultiple(assets);
|
|
11678
|
+
} else {
|
|
11679
|
+
assets.forEach((asset) => onChange(asset));
|
|
11680
|
+
}
|
|
11681
|
+
setSelectedFiles([]);
|
|
11682
|
+
setModalOpen(false);
|
|
11683
|
+
};
|
|
11492
11684
|
const handleFileUpload = async (e) => {
|
|
11493
|
-
const
|
|
11494
|
-
if (!
|
|
11685
|
+
const inputFiles = e.target.files;
|
|
11686
|
+
if (!inputFiles || inputFiles.length === 0) return;
|
|
11495
11687
|
setUploading(true);
|
|
11496
11688
|
try {
|
|
11497
11689
|
const formData = new FormData();
|
|
11498
|
-
for (let i = 0; i <
|
|
11499
|
-
formData.append("files",
|
|
11690
|
+
for (let i = 0; i < inputFiles.length; i++) {
|
|
11691
|
+
formData.append("files", inputFiles[i]);
|
|
11692
|
+
}
|
|
11693
|
+
if (currentFolderId) {
|
|
11694
|
+
formData.append("fileInfo", JSON.stringify({ folder: currentFolderId }));
|
|
11500
11695
|
}
|
|
11501
11696
|
const res = await post("/upload", formData);
|
|
11502
11697
|
const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
|
|
11503
11698
|
await loadLibrary();
|
|
11504
11699
|
if (uploadedList.length > 0) {
|
|
11505
|
-
|
|
11506
|
-
|
|
11700
|
+
if (!modalOpen) {
|
|
11701
|
+
if (multiple) {
|
|
11702
|
+
const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
|
|
11703
|
+
if (onSelectMultiple) {
|
|
11704
|
+
onSelectMultiple(assets);
|
|
11705
|
+
} else {
|
|
11706
|
+
assets.forEach((a) => onChange(a));
|
|
11707
|
+
}
|
|
11708
|
+
} else {
|
|
11709
|
+
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
11710
|
+
}
|
|
11711
|
+
} else if (multiple) {
|
|
11712
|
+
setSelectedFiles((prev) => [...prev, ...uploadedList]);
|
|
11713
|
+
} else {
|
|
11714
|
+
onChange(mapStrapiFileToAsset(uploadedList[0]));
|
|
11715
|
+
setModalOpen(false);
|
|
11716
|
+
}
|
|
11507
11717
|
}
|
|
11508
11718
|
} catch {
|
|
11509
11719
|
} finally {
|
|
@@ -11512,10 +11722,197 @@ const StrapiMediaPicker = ({
|
|
|
11512
11722
|
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
11513
11723
|
}
|
|
11514
11724
|
};
|
|
11725
|
+
const handleCreateFolder = async () => {
|
|
11726
|
+
const trimmed = newFolderName.trim();
|
|
11727
|
+
if (!trimmed) return;
|
|
11728
|
+
try {
|
|
11729
|
+
const res = await post("/content-input/media/folder", {
|
|
11730
|
+
name: trimmed,
|
|
11731
|
+
parent: currentFolderId
|
|
11732
|
+
});
|
|
11733
|
+
const created = res?.data?.data || res?.data;
|
|
11734
|
+
setNewFolderName("");
|
|
11735
|
+
setCreatingFolder(false);
|
|
11736
|
+
await loadLibrary();
|
|
11737
|
+
if (created?.id) {
|
|
11738
|
+
setCurrentFolderId(Number(created.id));
|
|
11739
|
+
}
|
|
11740
|
+
} catch {
|
|
11741
|
+
}
|
|
11742
|
+
};
|
|
11743
|
+
const handleSaveDetails = async () => {
|
|
11744
|
+
if (!editingFile?.id) return;
|
|
11745
|
+
setSavingDetails(true);
|
|
11746
|
+
try {
|
|
11747
|
+
const res = await put(`/content-input/media/${editingFile.id}`, {
|
|
11748
|
+
name: editName.trim() || editingFile.name,
|
|
11749
|
+
alternativeText: editAlt,
|
|
11750
|
+
caption: editCaption,
|
|
11751
|
+
folder: editFolderId
|
|
11752
|
+
});
|
|
11753
|
+
const updated = res?.data?.data || res?.data;
|
|
11754
|
+
await loadLibrary();
|
|
11755
|
+
if (updated) {
|
|
11756
|
+
setEditingFile(updated);
|
|
11757
|
+
}
|
|
11758
|
+
} catch {
|
|
11759
|
+
} finally {
|
|
11760
|
+
setSavingDetails(false);
|
|
11761
|
+
}
|
|
11762
|
+
};
|
|
11763
|
+
const handleDeleteAsset = async (file, e) => {
|
|
11764
|
+
if (e) {
|
|
11765
|
+
e.preventDefault();
|
|
11766
|
+
e.stopPropagation();
|
|
11767
|
+
}
|
|
11768
|
+
if (!file?.id) return;
|
|
11769
|
+
const confirmMsg = tr ? `"${file.name}" dosyasını Strapi Medya Kütüphanesinden kalıcı olarak silmek istediğinize emin misiniz?` : `Are you sure you want to permanently delete "${file.name}" from the Strapi Media Library?`;
|
|
11770
|
+
if (typeof window !== "undefined" && !window.confirm(confirmMsg)) return;
|
|
11771
|
+
try {
|
|
11772
|
+
await del(`/content-input/media/${file.id}`);
|
|
11773
|
+
setSelectedFiles((prev) => prev.filter((f) => getFileKey(f) !== getFileKey(file)));
|
|
11774
|
+
if (editingFile?.id === file.id) {
|
|
11775
|
+
setEditingFile(null);
|
|
11776
|
+
}
|
|
11777
|
+
await loadLibrary();
|
|
11778
|
+
} catch {
|
|
11779
|
+
}
|
|
11780
|
+
};
|
|
11781
|
+
const handleExecuteCrop = async (mode) => {
|
|
11782
|
+
if (!editingFile?.id) return;
|
|
11783
|
+
setCroppingBusy(true);
|
|
11784
|
+
setCropError(null);
|
|
11785
|
+
try {
|
|
11786
|
+
const res = await post("/content-input/media/crop", {
|
|
11787
|
+
id: editingFile.id,
|
|
11788
|
+
mode,
|
|
11789
|
+
x: Math.round(cropRect.x),
|
|
11790
|
+
y: Math.round(cropRect.y),
|
|
11791
|
+
width: Math.round(cropRect.width),
|
|
11792
|
+
height: Math.round(cropRect.height),
|
|
11793
|
+
rotate: cropRotate,
|
|
11794
|
+
name: editName.trim() || editingFile.name,
|
|
11795
|
+
alternativeText: editAlt,
|
|
11796
|
+
caption: editCaption
|
|
11797
|
+
});
|
|
11798
|
+
const resultFile = res?.data?.data || res?.data;
|
|
11799
|
+
await loadLibrary();
|
|
11800
|
+
if (resultFile) {
|
|
11801
|
+
const mapped = mapStrapiFileToAsset(resultFile, true);
|
|
11802
|
+
if (multiple && onSelectMultiple) {
|
|
11803
|
+
onSelectMultiple([mapped]);
|
|
11804
|
+
} else {
|
|
11805
|
+
onChange(mapped);
|
|
11806
|
+
}
|
|
11807
|
+
setEditingFile(null);
|
|
11808
|
+
setModalOpen(false);
|
|
11809
|
+
}
|
|
11810
|
+
} catch (err) {
|
|
11811
|
+
setCropError(err?.message || (tr ? "Kırpma işlemi başarısız oldu" : "Crop operation failed"));
|
|
11812
|
+
} finally {
|
|
11813
|
+
setCroppingBusy(false);
|
|
11814
|
+
}
|
|
11815
|
+
};
|
|
11816
|
+
const applyAspectPreset = (ratio) => {
|
|
11817
|
+
setAspectPreset(ratio);
|
|
11818
|
+
if (!ratio || !naturalSize.width || !naturalSize.height) return;
|
|
11819
|
+
let newW = naturalSize.width;
|
|
11820
|
+
let newH = Math.round(newW / ratio);
|
|
11821
|
+
if (newH > naturalSize.height) {
|
|
11822
|
+
newH = naturalSize.height;
|
|
11823
|
+
newW = Math.round(newH * ratio);
|
|
11824
|
+
}
|
|
11825
|
+
const newX = Math.max(0, Math.round((naturalSize.width - newW) / 2));
|
|
11826
|
+
const newY = Math.max(0, Math.round((naturalSize.height - newH) / 2));
|
|
11827
|
+
setCropRect({ x: newX, y: newY, width: newW, height: newH });
|
|
11828
|
+
};
|
|
11829
|
+
const startCropDrag = (e, dragType) => {
|
|
11830
|
+
e.preventDefault();
|
|
11831
|
+
e.stopPropagation();
|
|
11832
|
+
const container = cropBoxRef.current;
|
|
11833
|
+
if (!container || !naturalSize.width || !naturalSize.height) return;
|
|
11834
|
+
const bounds = container.getBoundingClientRect();
|
|
11835
|
+
if (!bounds.width || !bounds.height) return;
|
|
11836
|
+
const scaleX = naturalSize.width / bounds.width;
|
|
11837
|
+
const scaleY = naturalSize.height / bounds.height;
|
|
11838
|
+
const startClientX = e.clientX;
|
|
11839
|
+
const startClientY = e.clientY;
|
|
11840
|
+
const initial = { ...cropRect };
|
|
11841
|
+
const onMove = (ev) => {
|
|
11842
|
+
const dx = (ev.clientX - startClientX) * scaleX;
|
|
11843
|
+
const dy = (ev.clientY - startClientY) * scaleY;
|
|
11844
|
+
if (dragType === "move") {
|
|
11845
|
+
const nextX = Math.max(
|
|
11846
|
+
0,
|
|
11847
|
+
Math.min(naturalSize.width - initial.width, Math.round(initial.x + dx))
|
|
11848
|
+
);
|
|
11849
|
+
const nextY = Math.max(
|
|
11850
|
+
0,
|
|
11851
|
+
Math.min(naturalSize.height - initial.height, Math.round(initial.y + dy))
|
|
11852
|
+
);
|
|
11853
|
+
setCropRect({ ...initial, x: nextX, y: nextY });
|
|
11854
|
+
return;
|
|
11855
|
+
}
|
|
11856
|
+
let x = initial.x;
|
|
11857
|
+
let y = initial.y;
|
|
11858
|
+
let w = initial.width;
|
|
11859
|
+
let h = initial.height;
|
|
11860
|
+
if (dragType.includes("e")) {
|
|
11861
|
+
w = Math.max(20, Math.min(naturalSize.width - x, Math.round(initial.width + dx)));
|
|
11862
|
+
}
|
|
11863
|
+
if (dragType.includes("s")) {
|
|
11864
|
+
h = Math.max(20, Math.min(naturalSize.height - y, Math.round(initial.height + dy)));
|
|
11865
|
+
}
|
|
11866
|
+
if (dragType.includes("w")) {
|
|
11867
|
+
const maxDx = initial.width - 20;
|
|
11868
|
+
const clampedDx = Math.max(-initial.x, Math.min(maxDx, Math.round(dx)));
|
|
11869
|
+
x = initial.x + clampedDx;
|
|
11870
|
+
w = initial.width - clampedDx;
|
|
11871
|
+
}
|
|
11872
|
+
if (dragType.includes("n")) {
|
|
11873
|
+
const maxDy = initial.height - 20;
|
|
11874
|
+
const clampedDy = Math.max(-initial.y, Math.min(maxDy, Math.round(dy)));
|
|
11875
|
+
y = initial.y + clampedDy;
|
|
11876
|
+
h = initial.height - clampedDy;
|
|
11877
|
+
}
|
|
11878
|
+
if (aspectPreset) {
|
|
11879
|
+
h = Math.round(w / aspectPreset);
|
|
11880
|
+
if (y + h > naturalSize.height) {
|
|
11881
|
+
h = naturalSize.height - y;
|
|
11882
|
+
w = Math.round(h * aspectPreset);
|
|
11883
|
+
}
|
|
11884
|
+
}
|
|
11885
|
+
setCropRect({ x, y, width: Math.max(16, w), height: Math.max(16, h) });
|
|
11886
|
+
};
|
|
11887
|
+
const onUp = () => {
|
|
11888
|
+
window.removeEventListener("mousemove", onMove);
|
|
11889
|
+
window.removeEventListener("mouseup", onUp);
|
|
11890
|
+
};
|
|
11891
|
+
window.addEventListener("mousemove", onMove);
|
|
11892
|
+
window.addEventListener("mouseup", onUp);
|
|
11893
|
+
};
|
|
11515
11894
|
const handleUrlApply = () => {
|
|
11516
11895
|
const trimmed = urlInput.trim();
|
|
11517
11896
|
if (!trimmed) {
|
|
11518
|
-
if (value) onChange(null);
|
|
11897
|
+
if (!multiple && value) onChange(null);
|
|
11898
|
+
return;
|
|
11899
|
+
}
|
|
11900
|
+
if (multiple) {
|
|
11901
|
+
const parts = trimmed.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean);
|
|
11902
|
+
if (parts.length === 0) return;
|
|
11903
|
+
const assets = parts.map((u) => ({
|
|
11904
|
+
target_url: u,
|
|
11905
|
+
url: u,
|
|
11906
|
+
filename: u.split("/").pop() || "external-image",
|
|
11907
|
+
mime_type: "image/jpeg",
|
|
11908
|
+
caption: ""
|
|
11909
|
+
}));
|
|
11910
|
+
if (onSelectMultiple) {
|
|
11911
|
+
onSelectMultiple(assets);
|
|
11912
|
+
} else {
|
|
11913
|
+
assets.forEach((a) => onChange(a));
|
|
11914
|
+
}
|
|
11915
|
+
setUrlInput("");
|
|
11519
11916
|
return;
|
|
11520
11917
|
}
|
|
11521
11918
|
if (trimmed === (value?.target_url || value?.url || "")) return;
|
|
@@ -11529,9 +11926,39 @@ const StrapiMediaPicker = ({
|
|
|
11529
11926
|
};
|
|
11530
11927
|
const previewUrl = value?.target_url || value?.url || "";
|
|
11531
11928
|
const q = search.trim().toLowerCase();
|
|
11532
|
-
const
|
|
11533
|
-
|
|
11534
|
-
|
|
11929
|
+
const visibleFolders = folders.filter((fld) => {
|
|
11930
|
+
const parentId = fld.parent?.id ?? fld.parent ?? null;
|
|
11931
|
+
return parentId === currentFolderId;
|
|
11932
|
+
});
|
|
11933
|
+
const currentFolderObj = currentFolderId !== null ? folders.find((f) => Number(f.id) === currentFolderId) : null;
|
|
11934
|
+
const filteredFiles = files.filter((f) => {
|
|
11935
|
+
if (!q && currentFolderId !== null) {
|
|
11936
|
+
const fileFolderId = f.folder?.id ?? f.folder ?? null;
|
|
11937
|
+
if (Number(fileFolderId) !== currentFolderId) return false;
|
|
11938
|
+
}
|
|
11939
|
+
if (typeFilter === "image" && !f.mime?.startsWith("image/")) return false;
|
|
11940
|
+
if (typeFilter === "video" && !f.mime?.startsWith("video/")) return false;
|
|
11941
|
+
if (typeFilter === "audio" && !f.mime?.startsWith("audio/")) return false;
|
|
11942
|
+
if (typeFilter === "doc" && (f.mime?.startsWith("image/") || f.mime?.startsWith("video/") || f.mime?.startsWith("audio/"))) {
|
|
11943
|
+
return false;
|
|
11944
|
+
}
|
|
11945
|
+
if (!q) return true;
|
|
11946
|
+
return (f.name || "").toLowerCase().includes(q) || (f.alternativeText || "").toLowerCase().includes(q) || (f.caption || "").toLowerCase().includes(q) || (f.ext || "").toLowerCase().includes(q) || (f.mime || "").toLowerCase().includes(q);
|
|
11947
|
+
}).sort((a, b) => {
|
|
11948
|
+
if (sortBy === "oldest") {
|
|
11949
|
+
return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime();
|
|
11950
|
+
}
|
|
11951
|
+
if (sortBy === "nameAsc") {
|
|
11952
|
+
return String(a.name || "").localeCompare(String(b.name || ""));
|
|
11953
|
+
}
|
|
11954
|
+
if (sortBy === "nameDesc") {
|
|
11955
|
+
return String(b.name || "").localeCompare(String(a.name || ""));
|
|
11956
|
+
}
|
|
11957
|
+
if (sortBy === "sizeDesc") {
|
|
11958
|
+
return (Number(b.size) || 0) - (Number(a.size) || 0);
|
|
11959
|
+
}
|
|
11960
|
+
return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime();
|
|
11961
|
+
});
|
|
11535
11962
|
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
11536
11963
|
effectiveLabel && /* @__PURE__ */ jsx("label", { style: { fontSize: 12, fontWeight: 600, color: "#475569" }, children: effectiveLabel }),
|
|
11537
11964
|
previewUrl ? /* @__PURE__ */ jsxs(
|
|
@@ -11577,7 +12004,7 @@ const StrapiMediaPicker = ({
|
|
|
11577
12004
|
children: value?.filename || t("common.image", "Image")
|
|
11578
12005
|
}
|
|
11579
12006
|
),
|
|
11580
|
-
/* @__PURE__ */
|
|
12007
|
+
/* @__PURE__ */ jsxs(
|
|
11581
12008
|
"div",
|
|
11582
12009
|
{
|
|
11583
12010
|
style: {
|
|
@@ -11587,10 +12014,33 @@ const StrapiMediaPicker = ({
|
|
|
11587
12014
|
textOverflow: "ellipsis",
|
|
11588
12015
|
whiteSpace: "nowrap"
|
|
11589
12016
|
},
|
|
11590
|
-
children:
|
|
12017
|
+
children: [
|
|
12018
|
+
value?.width && value?.height ? `${value.width}×${value.height} · ` : "",
|
|
12019
|
+
previewUrl
|
|
12020
|
+
]
|
|
11591
12021
|
}
|
|
11592
12022
|
)
|
|
11593
12023
|
] }),
|
|
12024
|
+
/* @__PURE__ */ jsx(
|
|
12025
|
+
"button",
|
|
12026
|
+
{
|
|
12027
|
+
type: "button",
|
|
12028
|
+
onClick: handleOpenCropCurrent,
|
|
12029
|
+
title: tr ? "Görseli Kırp / Düzenle" : "Crop / Edit Image",
|
|
12030
|
+
style: {
|
|
12031
|
+
border: "1px solid #cbd5e1",
|
|
12032
|
+
borderRadius: 4,
|
|
12033
|
+
background: "#ffffff",
|
|
12034
|
+
color: "#2669a0",
|
|
12035
|
+
cursor: "pointer",
|
|
12036
|
+
padding: 4,
|
|
12037
|
+
display: "inline-flex",
|
|
12038
|
+
alignItems: "center",
|
|
12039
|
+
justifyContent: "center"
|
|
12040
|
+
},
|
|
12041
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: "crop", size: 15, color: "#2669a0" })
|
|
12042
|
+
}
|
|
12043
|
+
),
|
|
11594
12044
|
/* @__PURE__ */ jsx(
|
|
11595
12045
|
"button",
|
|
11596
12046
|
{
|
|
@@ -11639,6 +12089,44 @@ const StrapiMediaPicker = ({
|
|
|
11639
12089
|
}
|
|
11640
12090
|
}
|
|
11641
12091
|
),
|
|
12092
|
+
/* @__PURE__ */ jsx(
|
|
12093
|
+
"input",
|
|
12094
|
+
{
|
|
12095
|
+
ref: fileInputRef,
|
|
12096
|
+
type: "file",
|
|
12097
|
+
multiple,
|
|
12098
|
+
onChange: handleFileUpload,
|
|
12099
|
+
style: { display: "none" }
|
|
12100
|
+
}
|
|
12101
|
+
),
|
|
12102
|
+
/* @__PURE__ */ jsx(
|
|
12103
|
+
"button",
|
|
12104
|
+
{
|
|
12105
|
+
type: "button",
|
|
12106
|
+
disabled: uploading,
|
|
12107
|
+
onClick: (e) => {
|
|
12108
|
+
e.preventDefault();
|
|
12109
|
+
e.stopPropagation();
|
|
12110
|
+
fileInputRef.current?.click();
|
|
12111
|
+
},
|
|
12112
|
+
title: t("media.uploadNew", "Upload New File(s)"),
|
|
12113
|
+
style: {
|
|
12114
|
+
display: "inline-flex",
|
|
12115
|
+
alignItems: "center",
|
|
12116
|
+
justifyContent: "center",
|
|
12117
|
+
padding: "6px 9px",
|
|
12118
|
+
fontSize: 12,
|
|
12119
|
+
fontWeight: 600,
|
|
12120
|
+
background: "#ffffff",
|
|
12121
|
+
color: "#2669a0",
|
|
12122
|
+
border: "1px solid #cbd5e1",
|
|
12123
|
+
borderRadius: 5,
|
|
12124
|
+
cursor: uploading ? "wait" : "pointer",
|
|
12125
|
+
whiteSpace: "nowrap"
|
|
12126
|
+
},
|
|
12127
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 16, color: "#2669a0" })
|
|
12128
|
+
}
|
|
12129
|
+
),
|
|
11642
12130
|
/* @__PURE__ */ jsxs(
|
|
11643
12131
|
"button",
|
|
11644
12132
|
{
|
|
@@ -11659,8 +12147,8 @@ const StrapiMediaPicker = ({
|
|
|
11659
12147
|
whiteSpace: "nowrap"
|
|
11660
12148
|
},
|
|
11661
12149
|
children: [
|
|
11662
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "image", size: 15, color: "#fff" }),
|
|
11663
|
-
t("media.selectMedia", "Select Media")
|
|
12150
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: multiple ? "collections" : "image", size: 15, color: "#fff" }),
|
|
12151
|
+
multiple ? t("media.selectMultipleMedia", "Select Images") : t("media.selectMedia", "Select Media")
|
|
11664
12152
|
]
|
|
11665
12153
|
}
|
|
11666
12154
|
)
|
|
@@ -11673,27 +12161,31 @@ const StrapiMediaPicker = ({
|
|
|
11673
12161
|
style: {
|
|
11674
12162
|
position: "fixed",
|
|
11675
12163
|
inset: 0,
|
|
11676
|
-
background: "rgba(15, 23, 42, 0.
|
|
11677
|
-
zIndex:
|
|
12164
|
+
background: "rgba(15, 23, 42, 0.65)",
|
|
12165
|
+
zIndex: 310,
|
|
11678
12166
|
display: "flex",
|
|
11679
12167
|
alignItems: "center",
|
|
11680
12168
|
justifyContent: "center",
|
|
11681
|
-
padding:
|
|
12169
|
+
padding: 20
|
|
11682
12170
|
},
|
|
11683
12171
|
onClick: (e) => {
|
|
11684
12172
|
e.stopPropagation();
|
|
11685
|
-
|
|
12173
|
+
if (editingFile) {
|
|
12174
|
+
setEditingFile(null);
|
|
12175
|
+
} else {
|
|
12176
|
+
setModalOpen(false);
|
|
12177
|
+
}
|
|
11686
12178
|
},
|
|
11687
12179
|
children: /* @__PURE__ */ jsxs(
|
|
11688
12180
|
"div",
|
|
11689
12181
|
{
|
|
11690
12182
|
style: {
|
|
11691
12183
|
width: "100%",
|
|
11692
|
-
maxWidth:
|
|
11693
|
-
|
|
12184
|
+
maxWidth: 960,
|
|
12185
|
+
height: "min(720px, 90vh)",
|
|
11694
12186
|
background: "#fff",
|
|
11695
|
-
borderRadius:
|
|
11696
|
-
boxShadow: "0 24px
|
|
12187
|
+
borderRadius: 10,
|
|
12188
|
+
boxShadow: "0 24px 56px rgba(0,0,0,0.35)",
|
|
11697
12189
|
display: "flex",
|
|
11698
12190
|
flexDirection: "column",
|
|
11699
12191
|
overflow: "hidden"
|
|
@@ -11710,86 +12202,125 @@ const StrapiMediaPicker = ({
|
|
|
11710
12202
|
padding: "12px 18px",
|
|
11711
12203
|
borderBottom: "1px solid #e2e8f0",
|
|
11712
12204
|
background: "#f8fafc",
|
|
11713
|
-
gap: 10
|
|
12205
|
+
gap: 10,
|
|
12206
|
+
flexWrap: "wrap"
|
|
11714
12207
|
},
|
|
11715
12208
|
children: [
|
|
11716
12209
|
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
11717
|
-
/* @__PURE__ */
|
|
11718
|
-
/* @__PURE__ */ jsxs("strong", { style: { fontSize: 14, color: "#0f172a" }, children: [
|
|
11719
|
-
t("media.libraryTitle", "Strapi Media Library"),
|
|
11720
|
-
" (",
|
|
11721
|
-
files.length,
|
|
11722
|
-
" ",
|
|
11723
|
-
t("media.filesCount", "files"),
|
|
11724
|
-
")"
|
|
11725
|
-
] })
|
|
11726
|
-
] }),
|
|
11727
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
11728
|
-
/* @__PURE__ */ jsxs(
|
|
12210
|
+
editingFile ? /* @__PURE__ */ jsxs(
|
|
11729
12211
|
"button",
|
|
11730
12212
|
{
|
|
11731
12213
|
type: "button",
|
|
11732
|
-
onClick: () =>
|
|
11733
|
-
title: t("media.refresh", "Refresh"),
|
|
12214
|
+
onClick: () => setEditingFile(null),
|
|
11734
12215
|
style: {
|
|
11735
12216
|
display: "inline-flex",
|
|
11736
12217
|
alignItems: "center",
|
|
11737
12218
|
gap: 4,
|
|
11738
|
-
padding: "
|
|
12219
|
+
padding: "4px 8px",
|
|
12220
|
+
borderRadius: 5,
|
|
12221
|
+
border: "1px solid #cbd5e1",
|
|
11739
12222
|
background: "#ffffff",
|
|
11740
12223
|
color: "#334155",
|
|
11741
|
-
border: "1px solid #cbd5e1",
|
|
11742
|
-
borderRadius: 5,
|
|
11743
12224
|
fontSize: 12,
|
|
11744
12225
|
fontWeight: 600,
|
|
11745
12226
|
cursor: "pointer"
|
|
11746
12227
|
},
|
|
11747
12228
|
children: [
|
|
11748
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "
|
|
11749
|
-
|
|
12229
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "arrow_back", size: 15 }),
|
|
12230
|
+
tr ? "Kütüphaneye Dön" : "Back to Library"
|
|
11750
12231
|
]
|
|
11751
12232
|
}
|
|
11752
|
-
),
|
|
12233
|
+
) : /* @__PURE__ */ jsx(MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
|
|
12234
|
+
/* @__PURE__ */ jsx("strong", { style: { fontSize: 14, color: "#0f172a" }, children: editingFile ? `${tr ? "Görsel Düzenle & Kırp" : "Edit & Crop Asset"}: ${editingFile.name}` : `${t("media.libraryTitle", "Strapi Media Library")} (${filteredFiles.length} ${t(
|
|
12235
|
+
"media.filesCount",
|
|
12236
|
+
"files"
|
|
12237
|
+
)})` })
|
|
12238
|
+
] }),
|
|
12239
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
12240
|
+
!editingFile && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12241
|
+
/* @__PURE__ */ jsxs(
|
|
12242
|
+
"button",
|
|
12243
|
+
{
|
|
12244
|
+
type: "button",
|
|
12245
|
+
onClick: () => setCreatingFolder((v) => !v),
|
|
12246
|
+
style: {
|
|
12247
|
+
display: "inline-flex",
|
|
12248
|
+
alignItems: "center",
|
|
12249
|
+
gap: 4,
|
|
12250
|
+
padding: "6px 10px",
|
|
12251
|
+
background: "#ffffff",
|
|
12252
|
+
color: "#334155",
|
|
12253
|
+
border: "1px solid #cbd5e1",
|
|
12254
|
+
borderRadius: 5,
|
|
12255
|
+
fontSize: 12,
|
|
12256
|
+
fontWeight: 600,
|
|
12257
|
+
cursor: "pointer"
|
|
12258
|
+
},
|
|
12259
|
+
children: [
|
|
12260
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "create_new_folder", size: 15, color: "#2669a0" }),
|
|
12261
|
+
tr ? "Yeni Klasör" : "New Folder"
|
|
12262
|
+
]
|
|
12263
|
+
}
|
|
12264
|
+
),
|
|
12265
|
+
/* @__PURE__ */ jsxs(
|
|
12266
|
+
"button",
|
|
12267
|
+
{
|
|
12268
|
+
type: "button",
|
|
12269
|
+
onClick: () => loadLibrary().finally(() => setLoading(false)),
|
|
12270
|
+
title: t("media.refresh", "Refresh"),
|
|
12271
|
+
style: {
|
|
12272
|
+
display: "inline-flex",
|
|
12273
|
+
alignItems: "center",
|
|
12274
|
+
gap: 4,
|
|
12275
|
+
padding: "6px 10px",
|
|
12276
|
+
background: "#ffffff",
|
|
12277
|
+
color: "#334155",
|
|
12278
|
+
border: "1px solid #cbd5e1",
|
|
12279
|
+
borderRadius: 5,
|
|
12280
|
+
fontSize: 12,
|
|
12281
|
+
fontWeight: 600,
|
|
12282
|
+
cursor: "pointer"
|
|
12283
|
+
},
|
|
12284
|
+
children: [
|
|
12285
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "refresh", size: 15 }),
|
|
12286
|
+
t("media.refresh", "Refresh")
|
|
12287
|
+
]
|
|
12288
|
+
}
|
|
12289
|
+
),
|
|
12290
|
+
/* @__PURE__ */ jsxs(
|
|
12291
|
+
"button",
|
|
12292
|
+
{
|
|
12293
|
+
type: "button",
|
|
12294
|
+
disabled: uploading,
|
|
12295
|
+
onClick: () => fileInputRef.current?.click(),
|
|
12296
|
+
style: {
|
|
12297
|
+
display: "inline-flex",
|
|
12298
|
+
alignItems: "center",
|
|
12299
|
+
gap: 5,
|
|
12300
|
+
padding: "6px 12px",
|
|
12301
|
+
background: "#2669a0",
|
|
12302
|
+
color: "#fff",
|
|
12303
|
+
border: "none",
|
|
12304
|
+
borderRadius: 5,
|
|
12305
|
+
fontSize: 12,
|
|
12306
|
+
fontWeight: 600,
|
|
12307
|
+
cursor: "pointer"
|
|
12308
|
+
},
|
|
12309
|
+
children: [
|
|
12310
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
|
|
12311
|
+
uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File(s)")
|
|
12312
|
+
]
|
|
12313
|
+
}
|
|
12314
|
+
)
|
|
12315
|
+
] }),
|
|
11753
12316
|
/* @__PURE__ */ jsx(
|
|
11754
|
-
"input",
|
|
11755
|
-
{
|
|
11756
|
-
ref: fileInputRef,
|
|
11757
|
-
type: "file",
|
|
11758
|
-
multiple: true,
|
|
11759
|
-
onChange: handleFileUpload,
|
|
11760
|
-
style: { display: "none" }
|
|
11761
|
-
}
|
|
11762
|
-
),
|
|
11763
|
-
/* @__PURE__ */ jsxs(
|
|
11764
12317
|
"button",
|
|
11765
12318
|
{
|
|
11766
12319
|
type: "button",
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
alignItems: "center",
|
|
11772
|
-
gap: 5,
|
|
11773
|
-
padding: "6px 12px",
|
|
11774
|
-
background: "#2669a0",
|
|
11775
|
-
color: "#fff",
|
|
11776
|
-
border: "none",
|
|
11777
|
-
borderRadius: 5,
|
|
11778
|
-
fontSize: 12,
|
|
11779
|
-
fontWeight: 600,
|
|
11780
|
-
cursor: "pointer"
|
|
11781
|
-
},
|
|
11782
|
-
children: [
|
|
11783
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
|
|
11784
|
-
uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File")
|
|
11785
|
-
]
|
|
11786
|
-
}
|
|
11787
|
-
),
|
|
11788
|
-
/* @__PURE__ */ jsx(
|
|
11789
|
-
"button",
|
|
11790
|
-
{
|
|
11791
|
-
type: "button",
|
|
11792
|
-
onClick: () => setModalOpen(false),
|
|
12320
|
+
onClick: () => {
|
|
12321
|
+
setEditingFile(null);
|
|
12322
|
+
setModalOpen(false);
|
|
12323
|
+
},
|
|
11793
12324
|
style: {
|
|
11794
12325
|
border: "none",
|
|
11795
12326
|
background: "transparent",
|
|
@@ -11804,151 +12335,1259 @@ const StrapiMediaPicker = ({
|
|
|
11804
12335
|
]
|
|
11805
12336
|
}
|
|
11806
12337
|
),
|
|
11807
|
-
/* @__PURE__ */
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
12338
|
+
editingFile ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flex: 1, minHeight: 0, overflow: "hidden" }, children: [
|
|
12339
|
+
/* @__PURE__ */ jsxs(
|
|
12340
|
+
"div",
|
|
12341
|
+
{
|
|
12342
|
+
style: {
|
|
12343
|
+
flex: 1,
|
|
12344
|
+
background: "repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%) 50% / 20px 20px",
|
|
12345
|
+
display: "flex",
|
|
12346
|
+
flexDirection: "column",
|
|
12347
|
+
minWidth: 0,
|
|
12348
|
+
borderRight: "1px solid #e2e8f0"
|
|
12349
|
+
},
|
|
12350
|
+
children: [
|
|
12351
|
+
editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxs(
|
|
12352
|
+
"div",
|
|
12353
|
+
{
|
|
12354
|
+
style: {
|
|
12355
|
+
display: "flex",
|
|
12356
|
+
alignItems: "center",
|
|
12357
|
+
justifyContent: "space-between",
|
|
12358
|
+
padding: "8px 14px",
|
|
12359
|
+
background: "#ffffff",
|
|
12360
|
+
borderBottom: "1px solid #e2e8f0",
|
|
12361
|
+
gap: 8,
|
|
12362
|
+
flexWrap: "wrap"
|
|
12363
|
+
},
|
|
12364
|
+
children: [
|
|
12365
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
12366
|
+
/* @__PURE__ */ jsx(
|
|
12367
|
+
"span",
|
|
12368
|
+
{
|
|
12369
|
+
style: {
|
|
12370
|
+
fontSize: 11,
|
|
12371
|
+
fontWeight: 700,
|
|
12372
|
+
color: "#475569",
|
|
12373
|
+
marginRight: 4
|
|
12374
|
+
},
|
|
12375
|
+
children: tr ? "En-Boy Oranı:" : "Aspect Ratio:"
|
|
12376
|
+
}
|
|
12377
|
+
),
|
|
12378
|
+
ASPECT_PRESETS.map((preset) => {
|
|
12379
|
+
const active = aspectPreset === preset.ratio;
|
|
12380
|
+
return /* @__PURE__ */ jsx(
|
|
12381
|
+
"button",
|
|
12382
|
+
{
|
|
12383
|
+
type: "button",
|
|
12384
|
+
onClick: () => applyAspectPreset(preset.ratio),
|
|
12385
|
+
style: {
|
|
12386
|
+
padding: "4px 8px",
|
|
12387
|
+
fontSize: 11,
|
|
12388
|
+
fontWeight: 600,
|
|
12389
|
+
borderRadius: 4,
|
|
12390
|
+
border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
|
|
12391
|
+
background: active ? "#2669a0" : "#ffffff",
|
|
12392
|
+
color: active ? "#ffffff" : "#334155",
|
|
12393
|
+
cursor: "pointer"
|
|
12394
|
+
},
|
|
12395
|
+
children: preset.label === "Free" ? tr ? "Serbest" : "Free" : preset.label
|
|
12396
|
+
},
|
|
12397
|
+
preset.label
|
|
12398
|
+
);
|
|
12399
|
+
})
|
|
12400
|
+
] }),
|
|
12401
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
12402
|
+
/* @__PURE__ */ jsxs(
|
|
12403
|
+
"button",
|
|
12404
|
+
{
|
|
12405
|
+
type: "button",
|
|
12406
|
+
onClick: () => setCropRotate((r) => (r - 90 + 360) % 360),
|
|
12407
|
+
title: tr ? "Sola Döndür (-90°)" : "Rotate Left (-90°)",
|
|
12408
|
+
style: {
|
|
12409
|
+
display: "inline-flex",
|
|
12410
|
+
alignItems: "center",
|
|
12411
|
+
gap: 3,
|
|
12412
|
+
padding: "4px 8px",
|
|
12413
|
+
fontSize: 11,
|
|
12414
|
+
fontWeight: 600,
|
|
12415
|
+
border: "1px solid #cbd5e1",
|
|
12416
|
+
borderRadius: 4,
|
|
12417
|
+
background: "#fff",
|
|
12418
|
+
color: "#334155",
|
|
12419
|
+
cursor: "pointer"
|
|
12420
|
+
},
|
|
12421
|
+
children: [
|
|
12422
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "rotate_left", size: 15 }),
|
|
12423
|
+
/* @__PURE__ */ jsx("span", { children: "-90°" })
|
|
12424
|
+
]
|
|
12425
|
+
}
|
|
12426
|
+
),
|
|
12427
|
+
/* @__PURE__ */ jsxs(
|
|
12428
|
+
"button",
|
|
12429
|
+
{
|
|
12430
|
+
type: "button",
|
|
12431
|
+
onClick: () => setCropRotate((r) => (r + 90) % 360),
|
|
12432
|
+
title: tr ? "Sağa Döndür (+90°)" : "Rotate Right (+90°)",
|
|
12433
|
+
style: {
|
|
12434
|
+
display: "inline-flex",
|
|
12435
|
+
alignItems: "center",
|
|
12436
|
+
gap: 3,
|
|
12437
|
+
padding: "4px 8px",
|
|
12438
|
+
fontSize: 11,
|
|
12439
|
+
fontWeight: 600,
|
|
12440
|
+
border: "1px solid #cbd5e1",
|
|
12441
|
+
borderRadius: 4,
|
|
12442
|
+
background: "#fff",
|
|
12443
|
+
color: "#334155",
|
|
12444
|
+
cursor: "pointer"
|
|
12445
|
+
},
|
|
12446
|
+
children: [
|
|
12447
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "rotate_right", size: 15 }),
|
|
12448
|
+
/* @__PURE__ */ jsx("span", { children: "+90°" })
|
|
12449
|
+
]
|
|
12450
|
+
}
|
|
12451
|
+
),
|
|
12452
|
+
/* @__PURE__ */ jsx(
|
|
12453
|
+
"button",
|
|
12454
|
+
{
|
|
12455
|
+
type: "button",
|
|
12456
|
+
onClick: () => {
|
|
12457
|
+
setCropRotate(0);
|
|
12458
|
+
setAspectPreset(null);
|
|
12459
|
+
setCropRect({
|
|
12460
|
+
x: 0,
|
|
12461
|
+
y: 0,
|
|
12462
|
+
width: naturalSize.width,
|
|
12463
|
+
height: naturalSize.height
|
|
12464
|
+
});
|
|
12465
|
+
},
|
|
12466
|
+
style: {
|
|
12467
|
+
padding: "4px 8px",
|
|
12468
|
+
fontSize: 11,
|
|
12469
|
+
fontWeight: 600,
|
|
12470
|
+
border: "1px solid #cbd5e1",
|
|
12471
|
+
borderRadius: 4,
|
|
12472
|
+
background: "#fff",
|
|
12473
|
+
color: "#64748b",
|
|
12474
|
+
cursor: "pointer"
|
|
12475
|
+
},
|
|
12476
|
+
children: tr ? "Sıfırla" : "Reset"
|
|
12477
|
+
}
|
|
12478
|
+
)
|
|
12479
|
+
] })
|
|
12480
|
+
]
|
|
12481
|
+
}
|
|
12482
|
+
),
|
|
12483
|
+
/* @__PURE__ */ jsx(
|
|
12484
|
+
"div",
|
|
12485
|
+
{
|
|
12486
|
+
style: {
|
|
12487
|
+
flex: 1,
|
|
12488
|
+
display: "flex",
|
|
12489
|
+
alignItems: "center",
|
|
12490
|
+
justifyContent: "center",
|
|
12491
|
+
padding: 24,
|
|
12492
|
+
overflow: "hidden",
|
|
12493
|
+
position: "relative"
|
|
12494
|
+
},
|
|
12495
|
+
children: editingFile.mime?.startsWith("image/") ? /* @__PURE__ */ jsxs(
|
|
11866
12496
|
"div",
|
|
12497
|
+
{
|
|
12498
|
+
ref: cropBoxRef,
|
|
12499
|
+
style: {
|
|
12500
|
+
position: "relative",
|
|
12501
|
+
display: "inline-block",
|
|
12502
|
+
maxWidth: "100%",
|
|
12503
|
+
maxHeight: "100%",
|
|
12504
|
+
boxShadow: "0 8px 24px rgba(15, 23, 42, 0.2)",
|
|
12505
|
+
userSelect: "none"
|
|
12506
|
+
},
|
|
12507
|
+
children: [
|
|
12508
|
+
/* @__PURE__ */ jsx(
|
|
12509
|
+
"img",
|
|
12510
|
+
{
|
|
12511
|
+
ref: cropImgRef,
|
|
12512
|
+
src: editingFile.url,
|
|
12513
|
+
alt: editingFile.name,
|
|
12514
|
+
onLoad: (e) => {
|
|
12515
|
+
const img = e.currentTarget;
|
|
12516
|
+
const nw = img.naturalWidth || editingFile.width || 800;
|
|
12517
|
+
const nh = img.naturalHeight || editingFile.height || 600;
|
|
12518
|
+
setNaturalSize({ width: nw, height: nh });
|
|
12519
|
+
setCropRect({ x: 0, y: 0, width: nw, height: nh });
|
|
12520
|
+
},
|
|
12521
|
+
style: {
|
|
12522
|
+
display: "block",
|
|
12523
|
+
maxWidth: "540px",
|
|
12524
|
+
maxHeight: "440px",
|
|
12525
|
+
width: "auto",
|
|
12526
|
+
height: "auto",
|
|
12527
|
+
transform: cropRotate ? `rotate(${cropRotate}deg)` : void 0,
|
|
12528
|
+
pointerEvents: "none"
|
|
12529
|
+
}
|
|
12530
|
+
}
|
|
12531
|
+
),
|
|
12532
|
+
naturalSize.width > 0 && naturalSize.height > 0 && /* @__PURE__ */ jsxs(
|
|
12533
|
+
"div",
|
|
12534
|
+
{
|
|
12535
|
+
onMouseDown: (e) => startCropDrag(e, "move"),
|
|
12536
|
+
style: {
|
|
12537
|
+
position: "absolute",
|
|
12538
|
+
left: `${cropRect.x / naturalSize.width * 100}%`,
|
|
12539
|
+
top: `${cropRect.y / naturalSize.height * 100}%`,
|
|
12540
|
+
width: `${cropRect.width / naturalSize.width * 100}%`,
|
|
12541
|
+
height: `${cropRect.height / naturalSize.height * 100}%`,
|
|
12542
|
+
border: "2px dashed #38bdf8",
|
|
12543
|
+
boxShadow: "0 0 0 9999px rgba(15, 23, 42, 0.55)",
|
|
12544
|
+
cursor: "move",
|
|
12545
|
+
boxSizing: "border-box"
|
|
12546
|
+
},
|
|
12547
|
+
children: [
|
|
12548
|
+
/* @__PURE__ */ jsxs(
|
|
12549
|
+
"div",
|
|
12550
|
+
{
|
|
12551
|
+
style: {
|
|
12552
|
+
position: "absolute",
|
|
12553
|
+
top: 6,
|
|
12554
|
+
left: 6,
|
|
12555
|
+
background: "rgba(15, 23, 42, 0.85)",
|
|
12556
|
+
color: "#ffffff",
|
|
12557
|
+
fontSize: 10,
|
|
12558
|
+
fontWeight: 700,
|
|
12559
|
+
padding: "2px 6px",
|
|
12560
|
+
borderRadius: 4,
|
|
12561
|
+
pointerEvents: "none",
|
|
12562
|
+
whiteSpace: "nowrap"
|
|
12563
|
+
},
|
|
12564
|
+
children: [
|
|
12565
|
+
Math.round(cropRect.width),
|
|
12566
|
+
" × ",
|
|
12567
|
+
Math.round(cropRect.height),
|
|
12568
|
+
" px"
|
|
12569
|
+
]
|
|
12570
|
+
}
|
|
12571
|
+
),
|
|
12572
|
+
[
|
|
12573
|
+
{ pos: "nw", top: -6, left: -6, cursor: "nwse-resize" },
|
|
12574
|
+
{ pos: "ne", top: -6, right: -6, cursor: "nesw-resize" },
|
|
12575
|
+
{ pos: "sw", bottom: -6, left: -6, cursor: "nesw-resize" },
|
|
12576
|
+
{ pos: "se", bottom: -6, right: -6, cursor: "nwse-resize" }
|
|
12577
|
+
].map((h) => /* @__PURE__ */ jsx(
|
|
12578
|
+
"div",
|
|
12579
|
+
{
|
|
12580
|
+
onMouseDown: (e) => startCropDrag(e, h.pos),
|
|
12581
|
+
style: {
|
|
12582
|
+
position: "absolute",
|
|
12583
|
+
top: "top" in h ? h.top : void 0,
|
|
12584
|
+
bottom: "bottom" in h ? h.bottom : void 0,
|
|
12585
|
+
left: "left" in h ? h.left : void 0,
|
|
12586
|
+
right: "right" in h ? h.right : void 0,
|
|
12587
|
+
width: 12,
|
|
12588
|
+
height: 12,
|
|
12589
|
+
background: "#ffffff",
|
|
12590
|
+
border: "2px solid #0284c7",
|
|
12591
|
+
borderRadius: 2,
|
|
12592
|
+
cursor: h.cursor
|
|
12593
|
+
}
|
|
12594
|
+
},
|
|
12595
|
+
h.pos
|
|
12596
|
+
))
|
|
12597
|
+
]
|
|
12598
|
+
}
|
|
12599
|
+
)
|
|
12600
|
+
]
|
|
12601
|
+
}
|
|
12602
|
+
) : /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", color: "#475569" }, children: [
|
|
12603
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "description", size: 56, color: "#64748b" }),
|
|
12604
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: 8, fontWeight: 600 }, children: editingFile.name })
|
|
12605
|
+
] })
|
|
12606
|
+
}
|
|
12607
|
+
)
|
|
12608
|
+
]
|
|
12609
|
+
}
|
|
12610
|
+
),
|
|
12611
|
+
/* @__PURE__ */ jsxs(
|
|
12612
|
+
"div",
|
|
12613
|
+
{
|
|
12614
|
+
style: {
|
|
12615
|
+
width: 320,
|
|
12616
|
+
background: "#ffffff",
|
|
12617
|
+
display: "flex",
|
|
12618
|
+
flexDirection: "column",
|
|
12619
|
+
overflowY: "auto",
|
|
12620
|
+
padding: 16,
|
|
12621
|
+
gap: 14
|
|
12622
|
+
},
|
|
12623
|
+
children: [
|
|
12624
|
+
editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxs(
|
|
12625
|
+
"div",
|
|
12626
|
+
{
|
|
12627
|
+
style: {
|
|
12628
|
+
padding: 12,
|
|
12629
|
+
borderRadius: 8,
|
|
12630
|
+
background: "#f8fafc",
|
|
12631
|
+
border: "1px solid #cbd5e1",
|
|
12632
|
+
display: "flex",
|
|
12633
|
+
flexDirection: "column",
|
|
12634
|
+
gap: 10
|
|
12635
|
+
},
|
|
12636
|
+
children: [
|
|
12637
|
+
/* @__PURE__ */ jsxs(
|
|
12638
|
+
"div",
|
|
12639
|
+
{
|
|
12640
|
+
style: {
|
|
12641
|
+
fontSize: 11,
|
|
12642
|
+
fontWeight: 700,
|
|
12643
|
+
color: "#1e3a8a",
|
|
12644
|
+
textTransform: "uppercase",
|
|
12645
|
+
display: "flex",
|
|
12646
|
+
alignItems: "center",
|
|
12647
|
+
gap: 5
|
|
12648
|
+
},
|
|
12649
|
+
children: [
|
|
12650
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "crop", size: 15, color: "#2669a0" }),
|
|
12651
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Kırpma Boyutları (Sharp)" : "Crop Coordinates (Sharp)" })
|
|
12652
|
+
]
|
|
12653
|
+
}
|
|
12654
|
+
),
|
|
12655
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
12656
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12657
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Genişlik (W px)" : "Width (W px)" }),
|
|
12658
|
+
/* @__PURE__ */ jsx(
|
|
12659
|
+
"input",
|
|
12660
|
+
{
|
|
12661
|
+
type: "number",
|
|
12662
|
+
min: 16,
|
|
12663
|
+
max: naturalSize.width || 1e4,
|
|
12664
|
+
value: Math.round(cropRect.width),
|
|
12665
|
+
onChange: (e) => setCropRect((prev) => ({
|
|
12666
|
+
...prev,
|
|
12667
|
+
width: Math.max(16, Number(e.target.value) || 16)
|
|
12668
|
+
})),
|
|
12669
|
+
style: {
|
|
12670
|
+
width: "100%",
|
|
12671
|
+
padding: "5px 8px",
|
|
12672
|
+
fontSize: 12,
|
|
12673
|
+
border: "1px solid #cbd5e1",
|
|
12674
|
+
borderRadius: 4
|
|
12675
|
+
}
|
|
12676
|
+
}
|
|
12677
|
+
)
|
|
12678
|
+
] }),
|
|
12679
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12680
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Yükseklik (H px)" : "Height (H px)" }),
|
|
12681
|
+
/* @__PURE__ */ jsx(
|
|
12682
|
+
"input",
|
|
12683
|
+
{
|
|
12684
|
+
type: "number",
|
|
12685
|
+
min: 16,
|
|
12686
|
+
max: naturalSize.height || 1e4,
|
|
12687
|
+
value: Math.round(cropRect.height),
|
|
12688
|
+
onChange: (e) => setCropRect((prev) => ({
|
|
12689
|
+
...prev,
|
|
12690
|
+
height: Math.max(16, Number(e.target.value) || 16)
|
|
12691
|
+
})),
|
|
12692
|
+
style: {
|
|
12693
|
+
width: "100%",
|
|
12694
|
+
padding: "5px 8px",
|
|
12695
|
+
fontSize: 12,
|
|
12696
|
+
border: "1px solid #cbd5e1",
|
|
12697
|
+
borderRadius: 4
|
|
12698
|
+
}
|
|
12699
|
+
}
|
|
12700
|
+
)
|
|
12701
|
+
] }),
|
|
12702
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12703
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "X (Sol / Left px)" }),
|
|
12704
|
+
/* @__PURE__ */ jsx(
|
|
12705
|
+
"input",
|
|
12706
|
+
{
|
|
12707
|
+
type: "number",
|
|
12708
|
+
min: 0,
|
|
12709
|
+
value: Math.round(cropRect.x),
|
|
12710
|
+
onChange: (e) => setCropRect((prev) => ({
|
|
12711
|
+
...prev,
|
|
12712
|
+
x: Math.max(0, Number(e.target.value) || 0)
|
|
12713
|
+
})),
|
|
12714
|
+
style: {
|
|
12715
|
+
width: "100%",
|
|
12716
|
+
padding: "5px 8px",
|
|
12717
|
+
fontSize: 12,
|
|
12718
|
+
border: "1px solid #cbd5e1",
|
|
12719
|
+
borderRadius: 4
|
|
12720
|
+
}
|
|
12721
|
+
}
|
|
12722
|
+
)
|
|
12723
|
+
] }),
|
|
12724
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12725
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "Y (Üst / Top px)" }),
|
|
12726
|
+
/* @__PURE__ */ jsx(
|
|
12727
|
+
"input",
|
|
12728
|
+
{
|
|
12729
|
+
type: "number",
|
|
12730
|
+
min: 0,
|
|
12731
|
+
value: Math.round(cropRect.y),
|
|
12732
|
+
onChange: (e) => setCropRect((prev) => ({
|
|
12733
|
+
...prev,
|
|
12734
|
+
y: Math.max(0, Number(e.target.value) || 0)
|
|
12735
|
+
})),
|
|
12736
|
+
style: {
|
|
12737
|
+
width: "100%",
|
|
12738
|
+
padding: "5px 8px",
|
|
12739
|
+
fontSize: 12,
|
|
12740
|
+
border: "1px solid #cbd5e1",
|
|
12741
|
+
borderRadius: 4
|
|
12742
|
+
}
|
|
12743
|
+
}
|
|
12744
|
+
)
|
|
12745
|
+
] })
|
|
12746
|
+
] }),
|
|
12747
|
+
cropError && /* @__PURE__ */ jsx(
|
|
12748
|
+
"div",
|
|
12749
|
+
{
|
|
12750
|
+
style: {
|
|
12751
|
+
padding: "6px 8px",
|
|
12752
|
+
borderRadius: 4,
|
|
12753
|
+
background: "#fef2f2",
|
|
12754
|
+
color: "#dc2626",
|
|
12755
|
+
fontSize: 11
|
|
12756
|
+
},
|
|
12757
|
+
children: cropError
|
|
12758
|
+
}
|
|
12759
|
+
),
|
|
12760
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
12761
|
+
/* @__PURE__ */ jsxs(
|
|
12762
|
+
"button",
|
|
12763
|
+
{
|
|
12764
|
+
type: "button",
|
|
12765
|
+
disabled: croppingBusy,
|
|
12766
|
+
onClick: () => handleExecuteCrop("duplicate"),
|
|
12767
|
+
style: {
|
|
12768
|
+
padding: "8px 12px",
|
|
12769
|
+
fontSize: 12,
|
|
12770
|
+
fontWeight: 700,
|
|
12771
|
+
borderRadius: 5,
|
|
12772
|
+
border: "none",
|
|
12773
|
+
background: "#2669a0",
|
|
12774
|
+
color: "#ffffff",
|
|
12775
|
+
cursor: croppingBusy ? "wait" : "pointer",
|
|
12776
|
+
display: "flex",
|
|
12777
|
+
alignItems: "center",
|
|
12778
|
+
justifyContent: "center",
|
|
12779
|
+
gap: 6
|
|
12780
|
+
},
|
|
12781
|
+
children: [
|
|
12782
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "content_copy", size: 15, color: "#fff" }),
|
|
12783
|
+
/* @__PURE__ */ jsx("span", { children: croppingBusy ? tr ? "İşleniyor..." : "Processing..." : tr ? "Kopyasını Oluştur & Kırp" : "Duplicate & Crop Asset" })
|
|
12784
|
+
]
|
|
12785
|
+
}
|
|
12786
|
+
),
|
|
12787
|
+
/* @__PURE__ */ jsxs(
|
|
12788
|
+
"button",
|
|
12789
|
+
{
|
|
12790
|
+
type: "button",
|
|
12791
|
+
disabled: croppingBusy,
|
|
12792
|
+
onClick: () => handleExecuteCrop("replace"),
|
|
12793
|
+
style: {
|
|
12794
|
+
padding: "7px 12px",
|
|
12795
|
+
fontSize: 12,
|
|
12796
|
+
fontWeight: 600,
|
|
12797
|
+
borderRadius: 5,
|
|
12798
|
+
border: "1px solid #2669a0",
|
|
12799
|
+
background: "#eff6ff",
|
|
12800
|
+
color: "#1e3a8a",
|
|
12801
|
+
cursor: croppingBusy ? "wait" : "pointer",
|
|
12802
|
+
display: "flex",
|
|
12803
|
+
alignItems: "center",
|
|
12804
|
+
justifyContent: "center",
|
|
12805
|
+
gap: 6
|
|
12806
|
+
},
|
|
12807
|
+
children: [
|
|
12808
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "crop", size: 15, color: "#1e3a8a" }),
|
|
12809
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Orijinal Görseli Kırp (Üzerine Yaz)" : "Crop Original Asset" })
|
|
12810
|
+
]
|
|
12811
|
+
}
|
|
12812
|
+
)
|
|
12813
|
+
] })
|
|
12814
|
+
]
|
|
12815
|
+
}
|
|
12816
|
+
),
|
|
12817
|
+
/* @__PURE__ */ jsxs(
|
|
12818
|
+
"div",
|
|
12819
|
+
{
|
|
12820
|
+
style: {
|
|
12821
|
+
display: "flex",
|
|
12822
|
+
flexDirection: "column",
|
|
12823
|
+
gap: 8,
|
|
12824
|
+
borderTop: "1px solid #e2e8f0",
|
|
12825
|
+
paddingTop: 12
|
|
12826
|
+
},
|
|
12827
|
+
children: [
|
|
12828
|
+
/* @__PURE__ */ jsx(
|
|
12829
|
+
"div",
|
|
12830
|
+
{
|
|
12831
|
+
style: {
|
|
12832
|
+
fontSize: 11,
|
|
12833
|
+
fontWeight: 700,
|
|
12834
|
+
color: "#334155",
|
|
12835
|
+
textTransform: "uppercase"
|
|
12836
|
+
},
|
|
12837
|
+
children: tr ? "Dosya Bilgileri (Metadata)" : "Asset Metadata"
|
|
12838
|
+
}
|
|
12839
|
+
),
|
|
12840
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12841
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Dosya Adı" : "File Name" }),
|
|
12842
|
+
/* @__PURE__ */ jsx(
|
|
12843
|
+
"input",
|
|
12844
|
+
{
|
|
12845
|
+
type: "text",
|
|
12846
|
+
value: editName,
|
|
12847
|
+
onChange: (e) => setEditName(e.target.value),
|
|
12848
|
+
style: {
|
|
12849
|
+
width: "100%",
|
|
12850
|
+
padding: "6px 8px",
|
|
12851
|
+
fontSize: 12,
|
|
12852
|
+
border: "1px solid #cbd5e1",
|
|
12853
|
+
borderRadius: 4,
|
|
12854
|
+
marginTop: 2
|
|
12855
|
+
}
|
|
12856
|
+
}
|
|
12857
|
+
)
|
|
12858
|
+
] }),
|
|
12859
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12860
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Alternatif Metin (Alt Text / SEO)" : "Alternative Text (Alt / SEO)" }),
|
|
12861
|
+
/* @__PURE__ */ jsx(
|
|
12862
|
+
"input",
|
|
12863
|
+
{
|
|
12864
|
+
type: "text",
|
|
12865
|
+
value: editAlt,
|
|
12866
|
+
onChange: (e) => setEditAlt(e.target.value),
|
|
12867
|
+
style: {
|
|
12868
|
+
width: "100%",
|
|
12869
|
+
padding: "6px 8px",
|
|
12870
|
+
fontSize: 12,
|
|
12871
|
+
border: "1px solid #cbd5e1",
|
|
12872
|
+
borderRadius: 4,
|
|
12873
|
+
marginTop: 2
|
|
12874
|
+
}
|
|
12875
|
+
}
|
|
12876
|
+
)
|
|
12877
|
+
] }),
|
|
12878
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12879
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Altyazı (Caption)" : "Caption" }),
|
|
12880
|
+
/* @__PURE__ */ jsx(
|
|
12881
|
+
"input",
|
|
12882
|
+
{
|
|
12883
|
+
type: "text",
|
|
12884
|
+
value: editCaption,
|
|
12885
|
+
onChange: (e) => setEditCaption(e.target.value),
|
|
12886
|
+
style: {
|
|
12887
|
+
width: "100%",
|
|
12888
|
+
padding: "6px 8px",
|
|
12889
|
+
fontSize: 12,
|
|
12890
|
+
border: "1px solid #cbd5e1",
|
|
12891
|
+
borderRadius: 4,
|
|
12892
|
+
marginTop: 2
|
|
12893
|
+
}
|
|
12894
|
+
}
|
|
12895
|
+
)
|
|
12896
|
+
] }),
|
|
12897
|
+
folders.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
12898
|
+
/* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Klasör Konumu" : "Folder Location" }),
|
|
12899
|
+
/* @__PURE__ */ jsxs(
|
|
12900
|
+
"select",
|
|
12901
|
+
{
|
|
12902
|
+
value: editFolderId ?? "",
|
|
12903
|
+
onChange: (e) => setEditFolderId(e.target.value ? Number(e.target.value) : null),
|
|
12904
|
+
style: {
|
|
12905
|
+
width: "100%",
|
|
12906
|
+
padding: "6px 8px",
|
|
12907
|
+
fontSize: 12,
|
|
12908
|
+
border: "1px solid #cbd5e1",
|
|
12909
|
+
borderRadius: 4,
|
|
12910
|
+
marginTop: 2,
|
|
12911
|
+
background: "#fff"
|
|
12912
|
+
},
|
|
12913
|
+
children: [
|
|
12914
|
+
/* @__PURE__ */ jsx("option", { value: "", children: tr ? "Ana Dizin (Root)" : "Media Library Root" }),
|
|
12915
|
+
folders.map((fld) => /* @__PURE__ */ jsx("option", { value: fld.id, children: fld.name }, fld.id))
|
|
12916
|
+
]
|
|
12917
|
+
}
|
|
12918
|
+
)
|
|
12919
|
+
] }),
|
|
12920
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6, marginTop: 4 }, children: [
|
|
12921
|
+
/* @__PURE__ */ jsx(
|
|
12922
|
+
"button",
|
|
12923
|
+
{
|
|
12924
|
+
type: "button",
|
|
12925
|
+
disabled: savingDetails,
|
|
12926
|
+
onClick: handleSaveDetails,
|
|
12927
|
+
style: {
|
|
12928
|
+
flex: 1,
|
|
12929
|
+
padding: "7px 10px",
|
|
12930
|
+
fontSize: 12,
|
|
12931
|
+
fontWeight: 600,
|
|
12932
|
+
borderRadius: 5,
|
|
12933
|
+
border: "1px solid #cbd5e1",
|
|
12934
|
+
background: "#f8fafc",
|
|
12935
|
+
color: "#0f172a",
|
|
12936
|
+
cursor: "pointer"
|
|
12937
|
+
},
|
|
12938
|
+
children: savingDetails ? tr ? "Kaydediliyor..." : "Saving..." : tr ? "Bilgileri Kaydet" : "Save Metadata"
|
|
12939
|
+
}
|
|
12940
|
+
),
|
|
12941
|
+
/* @__PURE__ */ jsx(
|
|
12942
|
+
"button",
|
|
12943
|
+
{
|
|
12944
|
+
type: "button",
|
|
12945
|
+
onClick: (e) => handleDeleteAsset(editingFile, e),
|
|
12946
|
+
title: tr ? "Dosyayı Kütüphaneden Sil" : "Delete from Media Library",
|
|
12947
|
+
style: {
|
|
12948
|
+
padding: "7px 10px",
|
|
12949
|
+
fontSize: 12,
|
|
12950
|
+
fontWeight: 600,
|
|
12951
|
+
borderRadius: 5,
|
|
12952
|
+
border: "1px solid #fecaca",
|
|
12953
|
+
background: "#fef2f2",
|
|
12954
|
+
color: "#dc2626",
|
|
12955
|
+
cursor: "pointer"
|
|
12956
|
+
},
|
|
12957
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: "delete_outline", size: 16, color: "#dc2626" })
|
|
12958
|
+
}
|
|
12959
|
+
)
|
|
12960
|
+
] })
|
|
12961
|
+
]
|
|
12962
|
+
}
|
|
12963
|
+
)
|
|
12964
|
+
]
|
|
12965
|
+
}
|
|
12966
|
+
)
|
|
12967
|
+
] }) : (
|
|
12968
|
+
/* VIEW 2: MEDIA LIBRARY BROWSER (Folders, Filters, Sort, Multi-Select, Item Actions) */
|
|
12969
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12970
|
+
creatingFolder && /* @__PURE__ */ jsxs(
|
|
12971
|
+
"div",
|
|
12972
|
+
{
|
|
12973
|
+
style: {
|
|
12974
|
+
padding: "8px 18px",
|
|
12975
|
+
background: "#eff6ff",
|
|
12976
|
+
borderBottom: "1px solid #bfdbfe",
|
|
12977
|
+
display: "flex",
|
|
12978
|
+
alignItems: "center",
|
|
12979
|
+
gap: 8
|
|
12980
|
+
},
|
|
12981
|
+
children: [
|
|
12982
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "folder", size: 16, color: "#2669a0" }),
|
|
12983
|
+
/* @__PURE__ */ jsx(
|
|
12984
|
+
"input",
|
|
12985
|
+
{
|
|
12986
|
+
type: "text",
|
|
12987
|
+
value: newFolderName,
|
|
12988
|
+
onChange: (e) => setNewFolderName(e.target.value),
|
|
12989
|
+
onKeyDown: (e) => {
|
|
12990
|
+
if (e.key === "Enter") {
|
|
12991
|
+
e.preventDefault();
|
|
12992
|
+
handleCreateFolder();
|
|
12993
|
+
}
|
|
12994
|
+
},
|
|
12995
|
+
placeholder: tr ? "Yeni klasör adı yazın..." : "Enter new folder name...",
|
|
12996
|
+
style: {
|
|
12997
|
+
flex: 1,
|
|
12998
|
+
padding: "5px 10px",
|
|
12999
|
+
fontSize: 12,
|
|
13000
|
+
border: "1px solid #93c5fd",
|
|
13001
|
+
borderRadius: 4,
|
|
13002
|
+
background: "#fff"
|
|
13003
|
+
}
|
|
13004
|
+
}
|
|
13005
|
+
),
|
|
13006
|
+
/* @__PURE__ */ jsx(
|
|
13007
|
+
"button",
|
|
13008
|
+
{
|
|
13009
|
+
type: "button",
|
|
13010
|
+
onClick: handleCreateFolder,
|
|
13011
|
+
style: {
|
|
13012
|
+
padding: "5px 12px",
|
|
13013
|
+
fontSize: 12,
|
|
13014
|
+
fontWeight: 600,
|
|
13015
|
+
background: "#2669a0",
|
|
13016
|
+
color: "#fff",
|
|
13017
|
+
border: "none",
|
|
13018
|
+
borderRadius: 4,
|
|
13019
|
+
cursor: "pointer"
|
|
13020
|
+
},
|
|
13021
|
+
children: tr ? "Oluştur" : "Create"
|
|
13022
|
+
}
|
|
13023
|
+
),
|
|
13024
|
+
/* @__PURE__ */ jsx(
|
|
13025
|
+
"button",
|
|
13026
|
+
{
|
|
13027
|
+
type: "button",
|
|
13028
|
+
onClick: () => setCreatingFolder(false),
|
|
13029
|
+
style: {
|
|
13030
|
+
padding: "5px 10px",
|
|
13031
|
+
fontSize: 12,
|
|
13032
|
+
border: "1px solid #cbd5e1",
|
|
13033
|
+
background: "#fff",
|
|
13034
|
+
borderRadius: 4,
|
|
13035
|
+
cursor: "pointer"
|
|
13036
|
+
},
|
|
13037
|
+
children: tr ? "İptal" : "Cancel"
|
|
13038
|
+
}
|
|
13039
|
+
)
|
|
13040
|
+
]
|
|
13041
|
+
}
|
|
13042
|
+
),
|
|
13043
|
+
/* @__PURE__ */ jsxs(
|
|
13044
|
+
"div",
|
|
13045
|
+
{
|
|
13046
|
+
style: {
|
|
13047
|
+
padding: "10px 18px",
|
|
13048
|
+
borderBottom: "1px solid #f1f5f9",
|
|
13049
|
+
display: "flex",
|
|
13050
|
+
alignItems: "center",
|
|
13051
|
+
gap: 8,
|
|
13052
|
+
flexWrap: "wrap"
|
|
13053
|
+
},
|
|
13054
|
+
children: [
|
|
13055
|
+
/* @__PURE__ */ jsx(
|
|
13056
|
+
"input",
|
|
13057
|
+
{
|
|
13058
|
+
type: "text",
|
|
13059
|
+
value: search,
|
|
13060
|
+
onChange: (e) => setSearch(e.target.value),
|
|
13061
|
+
placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
|
|
13062
|
+
style: {
|
|
13063
|
+
flex: 1,
|
|
13064
|
+
minWidth: 180,
|
|
13065
|
+
padding: "7px 10px",
|
|
13066
|
+
fontSize: 12,
|
|
13067
|
+
border: "1px solid #cbd5e1",
|
|
13068
|
+
borderRadius: 5
|
|
13069
|
+
}
|
|
13070
|
+
}
|
|
13071
|
+
),
|
|
13072
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4 }, children: [
|
|
13073
|
+
{ key: "all", label: tr ? "Tümü" : "All" },
|
|
13074
|
+
{ key: "image", label: tr ? "Görsel" : "Images" },
|
|
13075
|
+
{ key: "video", label: tr ? "Video" : "Videos" },
|
|
13076
|
+
{ key: "doc", label: tr ? "Belge" : "Docs" }
|
|
13077
|
+
].map((tf) => {
|
|
13078
|
+
const active = typeFilter === tf.key;
|
|
13079
|
+
return /* @__PURE__ */ jsx(
|
|
13080
|
+
"button",
|
|
13081
|
+
{
|
|
13082
|
+
type: "button",
|
|
13083
|
+
onClick: () => setTypeFilter(tf.key),
|
|
13084
|
+
style: {
|
|
13085
|
+
padding: "5px 9px",
|
|
13086
|
+
fontSize: 11,
|
|
13087
|
+
fontWeight: 600,
|
|
13088
|
+
borderRadius: 5,
|
|
13089
|
+
border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
|
|
13090
|
+
background: active ? "#eff6ff" : "#ffffff",
|
|
13091
|
+
color: active ? "#2669a0" : "#475569",
|
|
13092
|
+
cursor: "pointer"
|
|
13093
|
+
},
|
|
13094
|
+
children: tf.label
|
|
13095
|
+
},
|
|
13096
|
+
tf.key
|
|
13097
|
+
);
|
|
13098
|
+
}) }),
|
|
13099
|
+
/* @__PURE__ */ jsxs(
|
|
13100
|
+
"select",
|
|
13101
|
+
{
|
|
13102
|
+
value: sortBy,
|
|
13103
|
+
onChange: (e) => setSortBy(e.target.value),
|
|
13104
|
+
style: {
|
|
13105
|
+
padding: "6px 8px",
|
|
13106
|
+
fontSize: 11,
|
|
13107
|
+
fontWeight: 600,
|
|
13108
|
+
border: "1px solid #cbd5e1",
|
|
13109
|
+
borderRadius: 5,
|
|
13110
|
+
background: "#ffffff",
|
|
13111
|
+
color: "#334155"
|
|
13112
|
+
},
|
|
13113
|
+
children: [
|
|
13114
|
+
/* @__PURE__ */ jsx("option", { value: "newest", children: tr ? "En Yeni" : "Newest first" }),
|
|
13115
|
+
/* @__PURE__ */ jsx("option", { value: "oldest", children: tr ? "En Eski" : "Oldest first" }),
|
|
13116
|
+
/* @__PURE__ */ jsx("option", { value: "nameAsc", children: tr ? "Ad (A - Z)" : "Name (A - Z)" }),
|
|
13117
|
+
/* @__PURE__ */ jsx("option", { value: "nameDesc", children: tr ? "Ad (Z - A)" : "Name (Z - A)" }),
|
|
13118
|
+
/* @__PURE__ */ jsx("option", { value: "sizeDesc", children: tr ? "Boyut (Büyükten)" : "Size (Largest)" })
|
|
13119
|
+
]
|
|
13120
|
+
}
|
|
13121
|
+
),
|
|
13122
|
+
multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13123
|
+
/* @__PURE__ */ jsx(
|
|
13124
|
+
"button",
|
|
13125
|
+
{
|
|
13126
|
+
type: "button",
|
|
13127
|
+
onClick: () => {
|
|
13128
|
+
const existingKeys = new Set(selectedFiles.map(getFileKey));
|
|
13129
|
+
const additions = filteredFiles.filter(
|
|
13130
|
+
(f) => !existingKeys.has(getFileKey(f))
|
|
13131
|
+
);
|
|
13132
|
+
setSelectedFiles([...selectedFiles, ...additions]);
|
|
13133
|
+
},
|
|
13134
|
+
style: {
|
|
13135
|
+
padding: "6px 10px",
|
|
13136
|
+
fontSize: 11,
|
|
13137
|
+
fontWeight: 600,
|
|
13138
|
+
border: "1px solid #cbd5e1",
|
|
13139
|
+
borderRadius: 5,
|
|
13140
|
+
background: "#ffffff",
|
|
13141
|
+
color: "#334155",
|
|
13142
|
+
cursor: "pointer",
|
|
13143
|
+
whiteSpace: "nowrap"
|
|
13144
|
+
},
|
|
13145
|
+
children: t("selectAllVisible", "Select All")
|
|
13146
|
+
}
|
|
13147
|
+
),
|
|
13148
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsx(
|
|
13149
|
+
"button",
|
|
13150
|
+
{
|
|
13151
|
+
type: "button",
|
|
13152
|
+
onClick: () => setSelectedFiles([]),
|
|
13153
|
+
style: {
|
|
13154
|
+
padding: "6px 10px",
|
|
13155
|
+
fontSize: 11,
|
|
13156
|
+
fontWeight: 600,
|
|
13157
|
+
border: "1px solid #fecaca",
|
|
13158
|
+
borderRadius: 5,
|
|
13159
|
+
background: "#fef2f2",
|
|
13160
|
+
color: "#dc2626",
|
|
13161
|
+
cursor: "pointer",
|
|
13162
|
+
whiteSpace: "nowrap"
|
|
13163
|
+
},
|
|
13164
|
+
children: t("clearSelection", "Clear Selection")
|
|
13165
|
+
}
|
|
13166
|
+
)
|
|
13167
|
+
] })
|
|
13168
|
+
]
|
|
13169
|
+
}
|
|
13170
|
+
),
|
|
13171
|
+
(folders.length > 0 || currentFolderId !== null) && /* @__PURE__ */ jsxs(
|
|
13172
|
+
"div",
|
|
13173
|
+
{
|
|
13174
|
+
style: {
|
|
13175
|
+
padding: "8px 18px",
|
|
13176
|
+
borderBottom: "1px solid #f1f5f9",
|
|
13177
|
+
background: "#f8fafc",
|
|
13178
|
+
display: "flex",
|
|
13179
|
+
alignItems: "center",
|
|
13180
|
+
gap: 6,
|
|
13181
|
+
flexWrap: "wrap"
|
|
13182
|
+
},
|
|
13183
|
+
children: [
|
|
13184
|
+
/* @__PURE__ */ jsxs(
|
|
13185
|
+
"button",
|
|
13186
|
+
{
|
|
13187
|
+
type: "button",
|
|
13188
|
+
onClick: () => setCurrentFolderId(null),
|
|
13189
|
+
style: {
|
|
13190
|
+
display: "inline-flex",
|
|
13191
|
+
alignItems: "center",
|
|
13192
|
+
gap: 4,
|
|
13193
|
+
padding: "4px 8px",
|
|
13194
|
+
fontSize: 11,
|
|
13195
|
+
fontWeight: 700,
|
|
13196
|
+
borderRadius: 4,
|
|
13197
|
+
border: currentFolderId === null ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
|
|
13198
|
+
background: currentFolderId === null ? "#2669a0" : "#ffffff",
|
|
13199
|
+
color: currentFolderId === null ? "#ffffff" : "#334155",
|
|
13200
|
+
cursor: "pointer"
|
|
13201
|
+
},
|
|
13202
|
+
children: [
|
|
13203
|
+
/* @__PURE__ */ jsx(
|
|
13204
|
+
MaterialIcon,
|
|
13205
|
+
{
|
|
13206
|
+
name: "folder",
|
|
13207
|
+
size: 14,
|
|
13208
|
+
color: currentFolderId === null ? "#ffffff" : "#2669a0"
|
|
13209
|
+
}
|
|
13210
|
+
),
|
|
13211
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Ana Dizin" : "Media Library" })
|
|
13212
|
+
]
|
|
13213
|
+
}
|
|
13214
|
+
),
|
|
13215
|
+
currentFolderObj && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13216
|
+
/* @__PURE__ */ jsx("span", { style: { color: "#94a3b8", fontSize: 12 }, children: "/" }),
|
|
13217
|
+
/* @__PURE__ */ jsx(
|
|
13218
|
+
"span",
|
|
11867
13219
|
{
|
|
11868
13220
|
style: {
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
13221
|
+
fontSize: 12,
|
|
13222
|
+
fontWeight: 700,
|
|
13223
|
+
color: "#1e3a8a",
|
|
13224
|
+
padding: "3px 8px",
|
|
13225
|
+
background: "#dbeafe",
|
|
13226
|
+
borderRadius: 4
|
|
11875
13227
|
},
|
|
11876
|
-
children:
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
13228
|
+
children: currentFolderObj.name
|
|
13229
|
+
}
|
|
13230
|
+
)
|
|
13231
|
+
] }),
|
|
13232
|
+
visibleFolders.map((fld) => /* @__PURE__ */ jsxs(
|
|
13233
|
+
"button",
|
|
13234
|
+
{
|
|
13235
|
+
type: "button",
|
|
13236
|
+
onClick: () => setCurrentFolderId(Number(fld.id)),
|
|
13237
|
+
style: {
|
|
13238
|
+
display: "inline-flex",
|
|
13239
|
+
alignItems: "center",
|
|
13240
|
+
gap: 5,
|
|
13241
|
+
padding: "4px 10px",
|
|
13242
|
+
fontSize: 11,
|
|
13243
|
+
fontWeight: 600,
|
|
13244
|
+
borderRadius: 4,
|
|
13245
|
+
border: "1px solid #cbd5e1",
|
|
13246
|
+
background: "#ffffff",
|
|
13247
|
+
color: "#1e293b",
|
|
13248
|
+
cursor: "pointer"
|
|
13249
|
+
},
|
|
13250
|
+
children: [
|
|
13251
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "folder", size: 14, color: "#f59e0b" }),
|
|
13252
|
+
/* @__PURE__ */ jsx("span", { children: fld.name })
|
|
13253
|
+
]
|
|
13254
|
+
},
|
|
13255
|
+
fld.id
|
|
13256
|
+
))
|
|
13257
|
+
]
|
|
13258
|
+
}
|
|
13259
|
+
),
|
|
13260
|
+
/* @__PURE__ */ jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsx(
|
|
13261
|
+
"div",
|
|
13262
|
+
{
|
|
13263
|
+
style: {
|
|
13264
|
+
textAlign: "center",
|
|
13265
|
+
padding: 32,
|
|
13266
|
+
color: "#64748b",
|
|
13267
|
+
fontSize: 13
|
|
13268
|
+
},
|
|
13269
|
+
children: t("media.loadingFiles", "Loading media files...")
|
|
13270
|
+
}
|
|
13271
|
+
) : filteredFiles.length === 0 ? /* @__PURE__ */ jsx(
|
|
13272
|
+
"div",
|
|
13273
|
+
{
|
|
13274
|
+
style: {
|
|
13275
|
+
textAlign: "center",
|
|
13276
|
+
padding: 32,
|
|
13277
|
+
color: "#64748b",
|
|
13278
|
+
fontSize: 13
|
|
13279
|
+
},
|
|
13280
|
+
children: t(
|
|
13281
|
+
"media.noMatchingFiles",
|
|
13282
|
+
"No matching files found in the media library. Use the Upload New File button above to upload from your computer."
|
|
13283
|
+
)
|
|
13284
|
+
}
|
|
13285
|
+
) : /* @__PURE__ */ jsx(
|
|
13286
|
+
"div",
|
|
13287
|
+
{
|
|
13288
|
+
style: {
|
|
13289
|
+
display: "grid",
|
|
13290
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(160px, 1fr))",
|
|
13291
|
+
gap: 12
|
|
13292
|
+
},
|
|
13293
|
+
children: filteredFiles.map((file) => {
|
|
13294
|
+
const fileKey = getFileKey(file);
|
|
13295
|
+
const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
|
|
13296
|
+
const isMultiSelected = multiIndex !== -1;
|
|
13297
|
+
const isCurrent = multiple ? isMultiSelected : Boolean(
|
|
13298
|
+
previewUrl && (file.url === previewUrl.split("?")[0] || file.name === value?.filename)
|
|
13299
|
+
);
|
|
13300
|
+
const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
|
|
13301
|
+
return /* @__PURE__ */ jsxs(
|
|
13302
|
+
"div",
|
|
13303
|
+
{
|
|
13304
|
+
onClick: () => {
|
|
13305
|
+
if (multiple) {
|
|
13306
|
+
toggleFileSelection(file);
|
|
13307
|
+
} else {
|
|
13308
|
+
onChange(mapStrapiFileToAsset(file));
|
|
13309
|
+
setModalOpen(false);
|
|
13310
|
+
}
|
|
13311
|
+
},
|
|
13312
|
+
onDoubleClick: () => {
|
|
13313
|
+
if (multiple) {
|
|
13314
|
+
const asset = mapStrapiFileToAsset(file);
|
|
13315
|
+
const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
|
|
13316
|
+
if (onSelectMultiple) {
|
|
13317
|
+
onSelectMultiple(listToCommit);
|
|
13318
|
+
} else {
|
|
13319
|
+
listToCommit.forEach((a) => onChange(a));
|
|
13320
|
+
}
|
|
13321
|
+
setSelectedFiles([]);
|
|
13322
|
+
setModalOpen(false);
|
|
13323
|
+
}
|
|
13324
|
+
},
|
|
13325
|
+
style: {
|
|
13326
|
+
border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
|
|
13327
|
+
borderRadius: 6,
|
|
13328
|
+
overflow: "hidden",
|
|
13329
|
+
cursor: "pointer",
|
|
13330
|
+
background: isCurrent ? "#eff6ff" : "#fff",
|
|
13331
|
+
boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
|
|
13332
|
+
userSelect: "none",
|
|
13333
|
+
display: "flex",
|
|
13334
|
+
flexDirection: "column"
|
|
13335
|
+
},
|
|
13336
|
+
children: [
|
|
13337
|
+
/* @__PURE__ */ jsxs(
|
|
13338
|
+
"div",
|
|
13339
|
+
{
|
|
13340
|
+
style: {
|
|
13341
|
+
height: 112,
|
|
13342
|
+
background: "#f1f5f9",
|
|
13343
|
+
display: "flex",
|
|
13344
|
+
alignItems: "center",
|
|
13345
|
+
justifyContent: "center",
|
|
13346
|
+
position: "relative"
|
|
13347
|
+
},
|
|
13348
|
+
children: [
|
|
13349
|
+
file.mime?.startsWith("image/") ? /* @__PURE__ */ jsx(
|
|
13350
|
+
"img",
|
|
13351
|
+
{
|
|
13352
|
+
src: thumbSrc,
|
|
13353
|
+
alt: file.name,
|
|
13354
|
+
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
13355
|
+
}
|
|
13356
|
+
) : /* @__PURE__ */ jsx(MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
|
|
13357
|
+
multiple ? /* @__PURE__ */ jsx(
|
|
13358
|
+
"span",
|
|
13359
|
+
{
|
|
13360
|
+
style: {
|
|
13361
|
+
position: "absolute",
|
|
13362
|
+
top: 6,
|
|
13363
|
+
left: 6,
|
|
13364
|
+
minWidth: 22,
|
|
13365
|
+
height: 22,
|
|
13366
|
+
padding: isMultiSelected ? "0 6px" : 0,
|
|
13367
|
+
borderRadius: 11,
|
|
13368
|
+
background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.9)",
|
|
13369
|
+
border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
|
|
13370
|
+
color: "#ffffff",
|
|
13371
|
+
fontSize: 10,
|
|
13372
|
+
fontWeight: 700,
|
|
13373
|
+
display: "inline-flex",
|
|
13374
|
+
alignItems: "center",
|
|
13375
|
+
justifyContent: "center",
|
|
13376
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
13377
|
+
},
|
|
13378
|
+
children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
|
|
13379
|
+
}
|
|
13380
|
+
) : isCurrent && /* @__PURE__ */ jsx(
|
|
13381
|
+
"span",
|
|
13382
|
+
{
|
|
13383
|
+
style: {
|
|
13384
|
+
position: "absolute",
|
|
13385
|
+
top: 5,
|
|
13386
|
+
left: 5,
|
|
13387
|
+
background: "#2669a0",
|
|
13388
|
+
color: "#fff",
|
|
13389
|
+
fontSize: 9,
|
|
13390
|
+
fontWeight: 700,
|
|
13391
|
+
padding: "2px 6px",
|
|
13392
|
+
borderRadius: 4
|
|
13393
|
+
},
|
|
13394
|
+
children: t("media.selectedBadge", "SELECTED")
|
|
13395
|
+
}
|
|
13396
|
+
),
|
|
13397
|
+
/* @__PURE__ */ jsxs(
|
|
13398
|
+
"div",
|
|
13399
|
+
{
|
|
13400
|
+
style: {
|
|
13401
|
+
position: "absolute",
|
|
13402
|
+
top: 5,
|
|
13403
|
+
right: 5,
|
|
13404
|
+
display: "flex",
|
|
13405
|
+
gap: 4
|
|
13406
|
+
},
|
|
13407
|
+
onClick: (e) => e.stopPropagation(),
|
|
13408
|
+
children: [
|
|
13409
|
+
/* @__PURE__ */ jsx(
|
|
13410
|
+
"button",
|
|
13411
|
+
{
|
|
13412
|
+
type: "button",
|
|
13413
|
+
onClick: (e) => {
|
|
13414
|
+
e.stopPropagation();
|
|
13415
|
+
openEditorForFile(file, "crop");
|
|
13416
|
+
},
|
|
13417
|
+
title: file.mime?.startsWith("image/") ? tr ? "Görseli Kırp & Düzenle" : "Crop & Edit Image" : tr ? "Dosya Bilgilerini Düzenle" : "Edit File Details",
|
|
13418
|
+
style: {
|
|
13419
|
+
width: 24,
|
|
13420
|
+
height: 24,
|
|
13421
|
+
borderRadius: 4,
|
|
13422
|
+
border: "1px solid rgba(15,23,42,0.15)",
|
|
13423
|
+
background: "rgba(255,255,255,0.92)",
|
|
13424
|
+
color: "#1e293b",
|
|
13425
|
+
display: "inline-flex",
|
|
13426
|
+
alignItems: "center",
|
|
13427
|
+
justifyContent: "center",
|
|
13428
|
+
cursor: "pointer",
|
|
13429
|
+
padding: 0
|
|
13430
|
+
},
|
|
13431
|
+
children: /* @__PURE__ */ jsx(
|
|
13432
|
+
MaterialIcon,
|
|
13433
|
+
{
|
|
13434
|
+
name: file.mime?.startsWith("image/") ? "crop" : "edit",
|
|
13435
|
+
size: 14,
|
|
13436
|
+
color: "#2669a0"
|
|
13437
|
+
}
|
|
13438
|
+
)
|
|
13439
|
+
}
|
|
13440
|
+
),
|
|
13441
|
+
/* @__PURE__ */ jsx(
|
|
13442
|
+
"button",
|
|
13443
|
+
{
|
|
13444
|
+
type: "button",
|
|
13445
|
+
onClick: (e) => handleDeleteAsset(file, e),
|
|
13446
|
+
title: tr ? "Kütüphaneden Sil" : "Delete from Library",
|
|
13447
|
+
style: {
|
|
13448
|
+
width: 24,
|
|
13449
|
+
height: 24,
|
|
13450
|
+
borderRadius: 4,
|
|
13451
|
+
border: "1px solid rgba(15,23,42,0.15)",
|
|
13452
|
+
background: "rgba(255,255,255,0.92)",
|
|
13453
|
+
color: "#dc2626",
|
|
13454
|
+
display: "inline-flex",
|
|
13455
|
+
alignItems: "center",
|
|
13456
|
+
justifyContent: "center",
|
|
13457
|
+
cursor: "pointer",
|
|
13458
|
+
padding: 0
|
|
13459
|
+
},
|
|
13460
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: "delete_outline", size: 14, color: "#dc2626" })
|
|
13461
|
+
}
|
|
13462
|
+
)
|
|
13463
|
+
]
|
|
13464
|
+
}
|
|
13465
|
+
),
|
|
13466
|
+
file.ext && /* @__PURE__ */ jsx(
|
|
13467
|
+
"span",
|
|
13468
|
+
{
|
|
13469
|
+
style: {
|
|
13470
|
+
position: "absolute",
|
|
13471
|
+
bottom: 4,
|
|
13472
|
+
right: 4,
|
|
13473
|
+
background: "rgba(15,23,42,0.75)",
|
|
13474
|
+
color: "#fff",
|
|
13475
|
+
fontSize: 9,
|
|
13476
|
+
fontWeight: 700,
|
|
13477
|
+
padding: "1px 5px",
|
|
13478
|
+
borderRadius: 3,
|
|
13479
|
+
textTransform: "uppercase"
|
|
13480
|
+
},
|
|
13481
|
+
children: file.ext.replace(".", "")
|
|
13482
|
+
}
|
|
13483
|
+
)
|
|
13484
|
+
]
|
|
13485
|
+
}
|
|
13486
|
+
),
|
|
13487
|
+
/* @__PURE__ */ jsxs("div", { style: { padding: "6px 8px" }, children: [
|
|
13488
|
+
/* @__PURE__ */ jsx(
|
|
13489
|
+
"div",
|
|
11887
13490
|
{
|
|
11888
13491
|
style: {
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
fontWeight: 700,
|
|
11896
|
-
padding: "2px 6px",
|
|
11897
|
-
borderRadius: 4
|
|
13492
|
+
fontSize: 11,
|
|
13493
|
+
fontWeight: 600,
|
|
13494
|
+
color: "#1e293b",
|
|
13495
|
+
overflow: "hidden",
|
|
13496
|
+
textOverflow: "ellipsis",
|
|
13497
|
+
whiteSpace: "nowrap"
|
|
11898
13498
|
},
|
|
11899
|
-
|
|
13499
|
+
title: file.name,
|
|
13500
|
+
children: file.name
|
|
11900
13501
|
}
|
|
11901
13502
|
),
|
|
11902
|
-
file.
|
|
11903
|
-
"
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
13503
|
+
(file.width || file.size) && /* @__PURE__ */ jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
|
|
13504
|
+
file.width && file.height ? `${file.width}×${file.height}` : "",
|
|
13505
|
+
file.width && file.size ? " · " : "",
|
|
13506
|
+
file.size ? `${Math.round(Number(file.size))} KB` : ""
|
|
13507
|
+
] })
|
|
13508
|
+
] })
|
|
13509
|
+
]
|
|
13510
|
+
},
|
|
13511
|
+
fileKey
|
|
13512
|
+
);
|
|
13513
|
+
})
|
|
13514
|
+
}
|
|
13515
|
+
) }),
|
|
13516
|
+
/* @__PURE__ */ jsxs(
|
|
13517
|
+
"div",
|
|
13518
|
+
{
|
|
13519
|
+
style: {
|
|
13520
|
+
display: "flex",
|
|
13521
|
+
alignItems: "center",
|
|
13522
|
+
justifyContent: "space-between",
|
|
13523
|
+
padding: "12px 18px",
|
|
13524
|
+
borderTop: "1px solid #e2e8f0",
|
|
13525
|
+
background: "#f8fafc",
|
|
13526
|
+
gap: 12
|
|
13527
|
+
},
|
|
13528
|
+
children: [
|
|
13529
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: multiple ? selectedFiles.length > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
|
|
13530
|
+
selectedFiles.length,
|
|
13531
|
+
" ",
|
|
13532
|
+
t("selectedCountLabel", "selected")
|
|
13533
|
+
] }) : /* @__PURE__ */ jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) : /* @__PURE__ */ jsx("span", { children: tr ? "Seçmek için görsele tıklayın; kırpmak veya düzenlemek için sağ üstteki Kırp ikonunu kullanın." : "Click an image to select it, or click the Crop icon on any card to crop/edit." }) }),
|
|
13534
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
13535
|
+
/* @__PURE__ */ jsx(
|
|
13536
|
+
"button",
|
|
13537
|
+
{
|
|
13538
|
+
type: "button",
|
|
13539
|
+
onClick: () => {
|
|
13540
|
+
setSelectedFiles([]);
|
|
13541
|
+
setModalOpen(false);
|
|
13542
|
+
},
|
|
13543
|
+
style: {
|
|
13544
|
+
padding: "7px 14px",
|
|
13545
|
+
fontSize: 12,
|
|
13546
|
+
fontWeight: 600,
|
|
13547
|
+
border: "1px solid #cbd5e1",
|
|
13548
|
+
borderRadius: 5,
|
|
13549
|
+
background: "#ffffff",
|
|
13550
|
+
color: "#475569",
|
|
13551
|
+
cursor: "pointer"
|
|
13552
|
+
},
|
|
13553
|
+
children: t("cancel", "Cancel")
|
|
11921
13554
|
}
|
|
11922
13555
|
),
|
|
11923
|
-
/* @__PURE__ */ jsxs(
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
13556
|
+
multiple && /* @__PURE__ */ jsxs(
|
|
13557
|
+
"button",
|
|
13558
|
+
{
|
|
13559
|
+
type: "button",
|
|
13560
|
+
disabled: selectedFiles.length === 0,
|
|
13561
|
+
onClick: handleConfirmMultiple,
|
|
13562
|
+
style: {
|
|
13563
|
+
display: "inline-flex",
|
|
13564
|
+
alignItems: "center",
|
|
13565
|
+
gap: 6,
|
|
13566
|
+
padding: "7px 16px",
|
|
13567
|
+
fontSize: 12,
|
|
13568
|
+
fontWeight: 700,
|
|
13569
|
+
border: "none",
|
|
13570
|
+
borderRadius: 5,
|
|
13571
|
+
background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
|
|
13572
|
+
color: "#ffffff",
|
|
13573
|
+
cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
|
|
13574
|
+
},
|
|
13575
|
+
children: [
|
|
13576
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
|
|
13577
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
13578
|
+
t("addSelectedMedia", "Add Selected"),
|
|
13579
|
+
" ",
|
|
13580
|
+
selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
|
|
13581
|
+
] })
|
|
13582
|
+
]
|
|
13583
|
+
}
|
|
13584
|
+
)
|
|
13585
|
+
] })
|
|
13586
|
+
]
|
|
13587
|
+
}
|
|
13588
|
+
)
|
|
13589
|
+
] })
|
|
13590
|
+
)
|
|
11952
13591
|
]
|
|
11953
13592
|
}
|
|
11954
13593
|
)
|
|
@@ -13045,18 +14684,54 @@ const WidgetEditor = ({ widget, onChange }) => {
|
|
|
13045
14684
|
{
|
|
13046
14685
|
label: t("addGalleryImage"),
|
|
13047
14686
|
value: null,
|
|
14687
|
+
multiple: true,
|
|
13048
14688
|
onChange: (asset) => {
|
|
13049
14689
|
if (asset) updateData([...images, asset]);
|
|
14690
|
+
},
|
|
14691
|
+
onSelectMultiple: (newAssets) => {
|
|
14692
|
+
if (newAssets && newAssets.length > 0) {
|
|
14693
|
+
updateData([...images, ...newAssets]);
|
|
14694
|
+
}
|
|
13050
14695
|
}
|
|
13051
14696
|
}
|
|
13052
14697
|
) }),
|
|
13053
14698
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
13054
|
-
/* @__PURE__ */ jsxs(
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
14699
|
+
/* @__PURE__ */ jsxs(
|
|
14700
|
+
"div",
|
|
14701
|
+
{
|
|
14702
|
+
style: {
|
|
14703
|
+
display: "flex",
|
|
14704
|
+
alignItems: "center",
|
|
14705
|
+
justifyContent: "space-between",
|
|
14706
|
+
marginBottom: 4
|
|
14707
|
+
},
|
|
14708
|
+
children: [
|
|
14709
|
+
/* @__PURE__ */ jsxs("label", { style: { ...labelStyle, marginBottom: 0 }, children: [
|
|
14710
|
+
t("galleryImages"),
|
|
14711
|
+
" (",
|
|
14712
|
+
images.length,
|
|
14713
|
+
")"
|
|
14714
|
+
] }),
|
|
14715
|
+
images.length > 1 && /* @__PURE__ */ jsx(
|
|
14716
|
+
"button",
|
|
14717
|
+
{
|
|
14718
|
+
type: "button",
|
|
14719
|
+
onClick: () => updateData([]),
|
|
14720
|
+
style: {
|
|
14721
|
+
border: "none",
|
|
14722
|
+
background: "transparent",
|
|
14723
|
+
color: "#dc2626",
|
|
14724
|
+
fontSize: 11,
|
|
14725
|
+
fontWeight: 600,
|
|
14726
|
+
cursor: "pointer",
|
|
14727
|
+
padding: "2px 4px"
|
|
14728
|
+
},
|
|
14729
|
+
children: t("clearAllImages")
|
|
14730
|
+
}
|
|
14731
|
+
)
|
|
14732
|
+
]
|
|
14733
|
+
}
|
|
14734
|
+
),
|
|
13060
14735
|
images.length === 0 ? /* @__PURE__ */ jsx(
|
|
13061
14736
|
"div",
|
|
13062
14737
|
{
|
|
@@ -16021,6 +17696,9 @@ const VisualEditorModal = ({ open, onClose }) => {
|
|
|
16021
17696
|
useEffect(() => {
|
|
16022
17697
|
if (!open) return;
|
|
16023
17698
|
const onKeyDown = (e) => {
|
|
17699
|
+
if (typeof document !== "undefined" && document.querySelector('[role="dialog"], [data-radix-popper-content-wrapper]')) {
|
|
17700
|
+
return;
|
|
17701
|
+
}
|
|
16024
17702
|
const target = e.target;
|
|
16025
17703
|
const isInput = target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable);
|
|
16026
17704
|
if (e.key === "Escape") {
|
|
@@ -16179,7 +17857,7 @@ const VisualEditorModal = ({ open, onClose }) => {
|
|
|
16179
17857
|
style: {
|
|
16180
17858
|
position: "fixed",
|
|
16181
17859
|
inset: 0,
|
|
16182
|
-
zIndex:
|
|
17860
|
+
zIndex: 200,
|
|
16183
17861
|
background: "#f8fafc",
|
|
16184
17862
|
display: "flex",
|
|
16185
17863
|
flexDirection: "column",
|
|
@@ -16433,7 +18111,7 @@ const CIContextMenu = () => {
|
|
|
16433
18111
|
position: "fixed",
|
|
16434
18112
|
left: pos.left,
|
|
16435
18113
|
top: pos.top,
|
|
16436
|
-
zIndex:
|
|
18114
|
+
zIndex: 250,
|
|
16437
18115
|
minWidth: 235,
|
|
16438
18116
|
background: "#ffffff",
|
|
16439
18117
|
border: "1px solid #cbd5e1",
|
|
@@ -18000,7 +19678,7 @@ const InnerContentBuilder = ({
|
|
|
18000
19678
|
position: "fixed",
|
|
18001
19679
|
inset: 0,
|
|
18002
19680
|
background: "rgba(15, 23, 42, 0.5)",
|
|
18003
|
-
zIndex:
|
|
19681
|
+
zIndex: 230,
|
|
18004
19682
|
display: "flex",
|
|
18005
19683
|
alignItems: "center",
|
|
18006
19684
|
justifyContent: "center",
|
|
@@ -18124,7 +19802,7 @@ const InnerContentBuilder = ({
|
|
|
18124
19802
|
position: "fixed",
|
|
18125
19803
|
inset: 0,
|
|
18126
19804
|
background: "rgba(15, 23, 42, 0.5)",
|
|
18127
|
-
zIndex:
|
|
19805
|
+
zIndex: 230,
|
|
18128
19806
|
display: "flex",
|
|
18129
19807
|
alignItems: "center",
|
|
18130
19808
|
justifyContent: "center",
|