@conloca/cms-spa 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/main.mjs +65 -26
- package/dist/main.mjs.map +1 -1
- package/dist/{puck-DyXDFCcg.mjs → puck-CvjeYQRH.mjs} +193 -167
- package/dist/puck-CvjeYQRH.mjs.map +1 -0
- package/dist/spa/main.css +50 -0
- package/package.json +7 -7
- package/dist/puck-DyXDFCcg.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ import { BlockTypeSelect, BoldItalicUnderlineToggles, CreateLink, DiffSourceTogg
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import "@mdxeditor/editor/style.css";
|
|
4
4
|
import { Folder, FolderPlus, Search, Upload, X } from "lucide-react";
|
|
5
|
-
import { useAssetFolders, useAssetUsage, useCreateFolder, useDeleteAsset, useFolderTree as useFolderTree$1, useImportAssetUrl, useMoveAssets, useUpdateAssetMetadata, useUploadAsset } from "@conloca/content-api-client";
|
|
5
|
+
import { useAssetFolders, useAssetUsage, useBulkDeleteAssets, useCreateFolder, useDeleteAsset, useFolderTree as useFolderTree$1, useImportAssetUrl, useMoveAssets, useUpdateAssetMetadata, useUploadAsset } from "@conloca/content-api-client";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { twMerge } from "tailwind-merge";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -239,6 +239,153 @@ async function buildUploadFormData(file, alt, folder) {
|
|
|
239
239
|
return formData;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/hooks/useUploadFlow.ts
|
|
244
|
+
const ACCEPTED_TYPES = "image/jpeg,image/png,image/gif,image/webp,image/svg+xml,image/avif";
|
|
245
|
+
function useUploadFlow({ folder, onUploadComplete, onSuccess }) {
|
|
246
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
247
|
+
const [altText, setAltText] = useState("");
|
|
248
|
+
const [pendingFile, setPendingFile] = useState(null);
|
|
249
|
+
const [activeTab, setActiveTab] = useState("file");
|
|
250
|
+
const [importUrl, setImportUrl] = useState("");
|
|
251
|
+
const [uploadProgress, setUploadProgress] = useState(null);
|
|
252
|
+
const fileInputRef = useRef(null);
|
|
253
|
+
const uploadMutation = useUploadAsset();
|
|
254
|
+
const importMutation = useImportAssetUrl();
|
|
255
|
+
const previewUrl = useMemo(() => {
|
|
256
|
+
if (!pendingFile) return null;
|
|
257
|
+
return URL.createObjectURL(pendingFile);
|
|
258
|
+
}, [pendingFile]);
|
|
259
|
+
useEffect(() => {
|
|
260
|
+
return () => {
|
|
261
|
+
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
|
262
|
+
};
|
|
263
|
+
}, [previewUrl]);
|
|
264
|
+
const isUploading = uploadMutation.isPending || importMutation.isPending || (uploadProgress?.inProgress ?? false);
|
|
265
|
+
const error = uploadMutation.error || importMutation.error;
|
|
266
|
+
const reset = useCallback(() => {
|
|
267
|
+
setPendingFile(null);
|
|
268
|
+
setAltText("");
|
|
269
|
+
setImportUrl("");
|
|
270
|
+
setUploadProgress(null);
|
|
271
|
+
setActiveTab("file");
|
|
272
|
+
setIsDragOver(false);
|
|
273
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
274
|
+
}, []);
|
|
275
|
+
const handleSingleFile = useCallback((file) => {
|
|
276
|
+
setPendingFile(file);
|
|
277
|
+
setAltText("");
|
|
278
|
+
}, []);
|
|
279
|
+
const handleMultipleFiles = useCallback(async (files) => {
|
|
280
|
+
if (files.length === 0) return;
|
|
281
|
+
if (files.length === 1) {
|
|
282
|
+
handleSingleFile(files[0]);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
setUploadProgress({
|
|
286
|
+
total: files.length,
|
|
287
|
+
completed: 0,
|
|
288
|
+
failed: 0,
|
|
289
|
+
inProgress: true
|
|
290
|
+
});
|
|
291
|
+
const uploadPromises = files.map(async (file) => {
|
|
292
|
+
const formData = await buildUploadFormData(file, void 0, folder);
|
|
293
|
+
return uploadMutation.mutateAsync(formData);
|
|
294
|
+
});
|
|
295
|
+
const results = await Promise.allSettled(uploadPromises);
|
|
296
|
+
const completed = results.filter((r) => r.status === "fulfilled").length;
|
|
297
|
+
const failed = results.filter((r) => r.status === "rejected").length;
|
|
298
|
+
setUploadProgress({
|
|
299
|
+
total: files.length,
|
|
300
|
+
completed,
|
|
301
|
+
failed,
|
|
302
|
+
inProgress: false
|
|
303
|
+
});
|
|
304
|
+
setTimeout(() => {
|
|
305
|
+
setUploadProgress(null);
|
|
306
|
+
if (completed > 0) onUploadComplete?.();
|
|
307
|
+
onSuccess?.();
|
|
308
|
+
}, 2e3);
|
|
309
|
+
}, [
|
|
310
|
+
folder,
|
|
311
|
+
uploadMutation,
|
|
312
|
+
handleSingleFile,
|
|
313
|
+
onUploadComplete,
|
|
314
|
+
onSuccess
|
|
315
|
+
]);
|
|
316
|
+
const handleFiles = useCallback((fileList) => {
|
|
317
|
+
if (!fileList || fileList.length === 0) return;
|
|
318
|
+
handleMultipleFiles(Array.from(fileList));
|
|
319
|
+
}, [handleMultipleFiles]);
|
|
320
|
+
const handleDragOver = useCallback((e) => {
|
|
321
|
+
e.preventDefault();
|
|
322
|
+
setIsDragOver(true);
|
|
323
|
+
}, []);
|
|
324
|
+
const handleDragLeave = useCallback((e) => {
|
|
325
|
+
e.preventDefault();
|
|
326
|
+
setIsDragOver(false);
|
|
327
|
+
}, []);
|
|
328
|
+
const handleDrop = useCallback((e) => {
|
|
329
|
+
e.preventDefault();
|
|
330
|
+
setIsDragOver(false);
|
|
331
|
+
handleFiles(e.dataTransfer.files);
|
|
332
|
+
}, [handleFiles]);
|
|
333
|
+
const handleUpload = async () => {
|
|
334
|
+
if (!pendingFile) return;
|
|
335
|
+
const formData = await buildUploadFormData(pendingFile, altText || void 0, folder);
|
|
336
|
+
uploadMutation.mutate(formData, { onSuccess: () => {
|
|
337
|
+
setPendingFile(null);
|
|
338
|
+
setAltText("");
|
|
339
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
340
|
+
onUploadComplete?.();
|
|
341
|
+
onSuccess?.();
|
|
342
|
+
} });
|
|
343
|
+
};
|
|
344
|
+
const handleImportUrl = () => {
|
|
345
|
+
if (!importUrl.trim()) return;
|
|
346
|
+
importMutation.mutate({
|
|
347
|
+
url: importUrl.trim(),
|
|
348
|
+
alt: altText || void 0,
|
|
349
|
+
folder
|
|
350
|
+
}, { onSuccess: () => {
|
|
351
|
+
setImportUrl("");
|
|
352
|
+
setAltText("");
|
|
353
|
+
onUploadComplete?.();
|
|
354
|
+
onSuccess?.();
|
|
355
|
+
} });
|
|
356
|
+
};
|
|
357
|
+
const handleCancel = () => {
|
|
358
|
+
setPendingFile(null);
|
|
359
|
+
setAltText("");
|
|
360
|
+
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
361
|
+
};
|
|
362
|
+
return {
|
|
363
|
+
isDragOver,
|
|
364
|
+
altText,
|
|
365
|
+
setAltText,
|
|
366
|
+
pendingFile,
|
|
367
|
+
activeTab,
|
|
368
|
+
setActiveTab,
|
|
369
|
+
importUrl,
|
|
370
|
+
setImportUrl,
|
|
371
|
+
uploadProgress,
|
|
372
|
+
fileInputRef,
|
|
373
|
+
previewUrl,
|
|
374
|
+
isUploading,
|
|
375
|
+
error,
|
|
376
|
+
uploadMutationIsPending: uploadMutation.isPending,
|
|
377
|
+
importMutationIsPending: importMutation.isPending,
|
|
378
|
+
handleFiles,
|
|
379
|
+
handleDragOver,
|
|
380
|
+
handleDragLeave,
|
|
381
|
+
handleDrop,
|
|
382
|
+
handleUpload,
|
|
383
|
+
handleImportUrl,
|
|
384
|
+
handleCancel,
|
|
385
|
+
reset
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
242
389
|
//#endregion
|
|
243
390
|
//#region src/utils/cn.ts
|
|
244
391
|
function cn$1(...inputs) {
|
|
@@ -676,30 +823,12 @@ function MediaLibrary({ folder: initialFolder = "/", onFolderChange, showToolbar
|
|
|
676
823
|
|
|
677
824
|
//#endregion
|
|
678
825
|
//#region src/components/media/UploadModal.tsx
|
|
679
|
-
const ACCEPTED_TYPES = "image/jpeg,image/png,image/gif,image/webp,image/svg+xml,image/avif";
|
|
680
826
|
function UploadModal({ isOpen, onClose, folder, onUploadComplete }) {
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
const [importUrl, setImportUrl] = useState("");
|
|
687
|
-
const [uploadProgress, setUploadProgress] = useState(null);
|
|
688
|
-
const fileInputRef = useRef(null);
|
|
689
|
-
const uploadMutation = useUploadAsset();
|
|
690
|
-
const importMutation = useImportAssetUrl();
|
|
691
|
-
const isUploading = uploadMutation.isPending || importMutation.isPending || (uploadProgress?.inProgress ?? false);
|
|
692
|
-
const error = uploadMutation.error || importMutation.error;
|
|
693
|
-
const resetState = useCallback(() => {
|
|
694
|
-
setPendingFile(null);
|
|
695
|
-
setAltText("");
|
|
696
|
-
setCustomName("");
|
|
697
|
-
setImportUrl("");
|
|
698
|
-
setUploadProgress(null);
|
|
699
|
-
setActiveTab("file");
|
|
700
|
-
setIsDragOver(false);
|
|
701
|
-
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
702
|
-
}, []);
|
|
827
|
+
const { activeTab, setActiveTab, isDragOver, pendingFile, altText, setAltText, importUrl, setImportUrl, uploadProgress, fileInputRef, previewUrl, isUploading, error, uploadMutationIsPending, importMutationIsPending, handleFiles, handleDragOver, handleDragLeave, handleDrop, handleUpload, handleImportUrl, handleCancel, reset } = useUploadFlow({
|
|
828
|
+
folder,
|
|
829
|
+
onUploadComplete,
|
|
830
|
+
onSuccess: onClose
|
|
831
|
+
});
|
|
703
832
|
useEffect(() => {
|
|
704
833
|
if (!isOpen) return;
|
|
705
834
|
const handleKeyDown = (e) => {
|
|
@@ -709,91 +838,8 @@ function UploadModal({ isOpen, onClose, folder, onUploadComplete }) {
|
|
|
709
838
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
710
839
|
}, [isOpen, onClose]);
|
|
711
840
|
useEffect(() => {
|
|
712
|
-
if (!isOpen)
|
|
713
|
-
}, [isOpen,
|
|
714
|
-
const handleSingleFile = useCallback((file) => {
|
|
715
|
-
setPendingFile(file);
|
|
716
|
-
setAltText("");
|
|
717
|
-
setCustomName("");
|
|
718
|
-
}, []);
|
|
719
|
-
const handleMultipleFiles = useCallback(async (files) => {
|
|
720
|
-
if (files.length === 0) return;
|
|
721
|
-
if (files.length === 1) {
|
|
722
|
-
handleSingleFile(files[0]);
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
setUploadProgress({
|
|
726
|
-
total: files.length,
|
|
727
|
-
completed: 0,
|
|
728
|
-
failed: 0,
|
|
729
|
-
inProgress: true
|
|
730
|
-
});
|
|
731
|
-
const uploadPromises = files.map(async (file) => {
|
|
732
|
-
const formData = await buildUploadFormData(file, void 0, folder);
|
|
733
|
-
return uploadMutation.mutateAsync(formData);
|
|
734
|
-
});
|
|
735
|
-
const results = await Promise.allSettled(uploadPromises);
|
|
736
|
-
const completed = results.filter((r) => r.status === "fulfilled").length;
|
|
737
|
-
const failed = results.filter((r) => r.status === "rejected").length;
|
|
738
|
-
setUploadProgress({
|
|
739
|
-
total: files.length,
|
|
740
|
-
completed,
|
|
741
|
-
failed,
|
|
742
|
-
inProgress: false
|
|
743
|
-
});
|
|
744
|
-
setTimeout(() => {
|
|
745
|
-
if (completed > 0) onUploadComplete?.();
|
|
746
|
-
onClose();
|
|
747
|
-
}, 2e3);
|
|
748
|
-
}, [
|
|
749
|
-
folder,
|
|
750
|
-
uploadMutation,
|
|
751
|
-
handleSingleFile,
|
|
752
|
-
onUploadComplete,
|
|
753
|
-
onClose
|
|
754
|
-
]);
|
|
755
|
-
const handleFiles = useCallback((fileList) => {
|
|
756
|
-
if (!fileList || fileList.length === 0) return;
|
|
757
|
-
handleMultipleFiles(Array.from(fileList));
|
|
758
|
-
}, [handleMultipleFiles]);
|
|
759
|
-
const handleDragOver = useCallback((e) => {
|
|
760
|
-
e.preventDefault();
|
|
761
|
-
setIsDragOver(true);
|
|
762
|
-
}, []);
|
|
763
|
-
const handleDragLeave = useCallback((e) => {
|
|
764
|
-
e.preventDefault();
|
|
765
|
-
setIsDragOver(false);
|
|
766
|
-
}, []);
|
|
767
|
-
const handleDrop = useCallback((e) => {
|
|
768
|
-
e.preventDefault();
|
|
769
|
-
setIsDragOver(false);
|
|
770
|
-
handleFiles(e.dataTransfer.files);
|
|
771
|
-
}, [handleFiles]);
|
|
772
|
-
const handleUpload = async () => {
|
|
773
|
-
if (!pendingFile) return;
|
|
774
|
-
const formData = await buildUploadFormData(pendingFile, altText || void 0, folder);
|
|
775
|
-
uploadMutation.mutate(formData, { onSuccess: () => {
|
|
776
|
-
onUploadComplete?.();
|
|
777
|
-
onClose();
|
|
778
|
-
} });
|
|
779
|
-
};
|
|
780
|
-
const handleImportUrl = () => {
|
|
781
|
-
if (!importUrl.trim()) return;
|
|
782
|
-
importMutation.mutate({
|
|
783
|
-
url: importUrl.trim(),
|
|
784
|
-
alt: altText || void 0,
|
|
785
|
-
folder
|
|
786
|
-
}, { onSuccess: () => {
|
|
787
|
-
onUploadComplete?.();
|
|
788
|
-
onClose();
|
|
789
|
-
} });
|
|
790
|
-
};
|
|
791
|
-
const handleCancel = () => {
|
|
792
|
-
setPendingFile(null);
|
|
793
|
-
setAltText("");
|
|
794
|
-
setCustomName("");
|
|
795
|
-
if (fileInputRef.current) fileInputRef.current.value = "";
|
|
796
|
-
};
|
|
841
|
+
if (!isOpen) reset();
|
|
842
|
+
}, [isOpen, reset]);
|
|
797
843
|
if (!isOpen) return null;
|
|
798
844
|
return /* @__PURE__ */ jsx("div", {
|
|
799
845
|
className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50",
|
|
@@ -853,59 +899,37 @@ function UploadModal({ isOpen, onClose, folder, onUploadComplete }) {
|
|
|
853
899
|
]
|
|
854
900
|
}), pendingFile ? /* @__PURE__ */ jsxs("div", {
|
|
855
901
|
className: "space-y-4",
|
|
856
|
-
children: [
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
className: "w-full h-full object-contain"
|
|
865
|
-
})
|
|
866
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
867
|
-
className: "flex-1 min-w-0",
|
|
868
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
869
|
-
className: "text-sm font-medium text-grey-01 truncate",
|
|
870
|
-
children: pendingFile.name
|
|
871
|
-
}), /* @__PURE__ */ jsxs("p", {
|
|
872
|
-
className: "text-xs text-grey-04",
|
|
873
|
-
children: [(pendingFile.size / 1024).toFixed(1), " KB"]
|
|
874
|
-
})]
|
|
875
|
-
})]
|
|
876
|
-
}),
|
|
877
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
878
|
-
/* @__PURE__ */ jsx("label", {
|
|
879
|
-
htmlFor: "custom-name",
|
|
880
|
-
className: "block text-xs text-grey-04 uppercase tracking-wide mb-1",
|
|
881
|
-
children: "Asset Name (optional)"
|
|
882
|
-
}),
|
|
883
|
-
/* @__PURE__ */ jsx("input", {
|
|
884
|
-
id: "custom-name",
|
|
885
|
-
type: "text",
|
|
886
|
-
value: customName,
|
|
887
|
-
onChange: (e) => setCustomName(e.target.value),
|
|
888
|
-
placeholder: pendingFile.name,
|
|
889
|
-
className: "w-full px-3 py-2 border border-grey-09 rounded text-sm focus:outline-none focus:ring-2 focus:ring-azure-04 focus:border-azure-04"
|
|
890
|
-
}),
|
|
891
|
-
/* @__PURE__ */ jsx("p", {
|
|
892
|
-
className: "mt-1 text-xs text-grey-07",
|
|
893
|
-
children: "Leave blank to use original filename"
|
|
902
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
903
|
+
className: "flex items-center gap-3",
|
|
904
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
905
|
+
className: "w-16 h-16 bg-grey-09 rounded overflow-hidden flex-shrink-0",
|
|
906
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
907
|
+
src: previewUrl,
|
|
908
|
+
alt: "Preview",
|
|
909
|
+
className: "w-full h-full object-contain"
|
|
894
910
|
})
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
911
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
912
|
+
className: "flex-1 min-w-0",
|
|
913
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
914
|
+
className: "text-sm font-medium text-grey-01 truncate",
|
|
915
|
+
children: pendingFile.name
|
|
916
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
917
|
+
className: "text-xs text-grey-04",
|
|
918
|
+
children: [(pendingFile.size / 1024).toFixed(1), " KB"]
|
|
919
|
+
})]
|
|
920
|
+
})]
|
|
921
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
922
|
+
htmlFor: "alt-text",
|
|
923
|
+
className: "block text-xs text-grey-04 uppercase tracking-wide mb-1",
|
|
924
|
+
children: "Alt Text"
|
|
925
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
926
|
+
id: "alt-text",
|
|
927
|
+
type: "text",
|
|
928
|
+
value: altText,
|
|
929
|
+
onChange: (e) => setAltText(e.target.value),
|
|
930
|
+
placeholder: "Describe the image for accessibility",
|
|
931
|
+
className: "w-full px-3 py-2 border border-grey-09 rounded text-sm focus:outline-none focus:ring-2 focus:ring-azure-04 focus:border-azure-04"
|
|
932
|
+
})] })]
|
|
909
933
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
910
934
|
onDragOver: handleDragOver,
|
|
911
935
|
onDragLeave: handleDragLeave,
|
|
@@ -985,13 +1009,13 @@ function UploadModal({ isOpen, onClose, folder, onUploadComplete }) {
|
|
|
985
1009
|
onClick: handleUpload,
|
|
986
1010
|
disabled: isUploading || !pendingFile,
|
|
987
1011
|
className: "flex items-center gap-2 px-4 py-2 bg-azure-04 text-white text-sm rounded hover:bg-azure-03 disabled:opacity-50 transition-colors",
|
|
988
|
-
children: [/* @__PURE__ */ jsx(Upload, { className: "w-4 h-4" }),
|
|
1012
|
+
children: [/* @__PURE__ */ jsx(Upload, { className: "w-4 h-4" }), uploadMutationIsPending ? "Uploading..." : "Upload"]
|
|
989
1013
|
}) : /* @__PURE__ */ jsxs("button", {
|
|
990
1014
|
type: "button",
|
|
991
1015
|
onClick: handleImportUrl,
|
|
992
1016
|
disabled: isUploading || !importUrl.trim(),
|
|
993
1017
|
className: "flex items-center gap-2 px-4 py-2 bg-azure-04 text-white text-sm rounded hover:bg-azure-03 disabled:opacity-50 transition-colors",
|
|
994
|
-
children: [/* @__PURE__ */ jsx(Upload, { className: "w-4 h-4" }),
|
|
1018
|
+
children: [/* @__PURE__ */ jsx(Upload, { className: "w-4 h-4" }), importMutationIsPending ? "Importing..." : "Import"]
|
|
995
1019
|
})]
|
|
996
1020
|
})
|
|
997
1021
|
]
|
|
@@ -1149,6 +1173,7 @@ var MDXEditorErrorBoundary = class extends React.Component {
|
|
|
1149
1173
|
* This component wraps MDXEditor with ImagePickerDialog and keyboard shortcuts.
|
|
1150
1174
|
*/
|
|
1151
1175
|
const CMSMDXEditor = React.forwardRef(({ value, onChange, onSave, readOnly = false }, ref) => {
|
|
1176
|
+
const insertImageRef = useRef(null);
|
|
1152
1177
|
useEffect(() => {
|
|
1153
1178
|
const handleKeyDown = (e) => {
|
|
1154
1179
|
if ((e.ctrlKey || e.metaKey) && e.key === "s") {
|
|
@@ -1157,7 +1182,8 @@ const CMSMDXEditor = React.forwardRef(({ value, onChange, onSave, readOnly = fal
|
|
|
1157
1182
|
}
|
|
1158
1183
|
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key.toLowerCase() === "i") {
|
|
1159
1184
|
e.preventDefault();
|
|
1160
|
-
|
|
1185
|
+
if (insertImageRef.current) insertImageRef.current.click();
|
|
1186
|
+
else console.warn("[CMSMDXEditor] InsertImage ref not attached — toolbar may not be rendered");
|
|
1161
1187
|
}
|
|
1162
1188
|
};
|
|
1163
1189
|
document.addEventListener("keydown", handleKeyDown);
|
|
@@ -1210,7 +1236,7 @@ const CMSMDXEditor = React.forwardRef(({ value, onChange, onSave, readOnly = fal
|
|
|
1210
1236
|
/* @__PURE__ */ jsx(BlockTypeSelect, {}),
|
|
1211
1237
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
1212
1238
|
/* @__PURE__ */ jsx(CreateLink, {}),
|
|
1213
|
-
|
|
1239
|
+
React.createElement(InsertImage, { ref: insertImageRef }),
|
|
1214
1240
|
/* @__PURE__ */ jsx(InsertTable, {}),
|
|
1215
1241
|
/* @__PURE__ */ jsx(InsertThematicBreak, {}),
|
|
1216
1242
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
@@ -1503,5 +1529,5 @@ function MDXContent(props) {
|
|
|
1503
1529
|
}
|
|
1504
1530
|
|
|
1505
1531
|
//#endregion
|
|
1506
|
-
export {
|
|
1507
|
-
//# sourceMappingURL=puck-
|
|
1532
|
+
export { configureUI as _, MediaLibrary as a, useDialogState as b, FolderTreeSidebar as c, useBulkDeleteAssets as d, useDeleteAsset as f, useSiteBaseUrl as g, useUpdateAssetMetadata as h, UploadModal as i, cn$1 as l, useMoveAssets as m, CMSMDXEditorModal as n, MediaToolbar as o, useFolderTree$1 as p, ImagePicker as r, buildAssetServeUrl as s, MDXContent as t, useAssetUsage as u, getUIConfig as v, useClickOutside as x, useErrorModal as y };
|
|
1533
|
+
//# sourceMappingURL=puck-CvjeYQRH.mjs.map
|