diff --git a/packages/editor/src/core/extensions/custom-image/components/image-node.tsx b/packages/editor/src/core/extensions/custom-image/components/image-node.tsx index 639036e2fe9..bcd7a6f1b89 100644 --- a/packages/editor/src/core/extensions/custom-image/components/image-node.tsx +++ b/packages/editor/src/core/extensions/custom-image/components/image-node.tsx @@ -56,7 +56,6 @@ export const CustomImageNode = (props: CustomImageNodeViewProps) => { // @ts-expect-error - TODO: fix typings, and don't remove await from // here for now const url: string = await editor?.commands.uploadImage(file); - console.log("url drop", url); if (!url) { throw new Error("Something went wrong while uploading the image"); diff --git a/packages/editor/src/core/extensions/custom-image/custom-image.ts b/packages/editor/src/core/extensions/custom-image/custom-image.ts index 86c0c22285c..73786e621f0 100644 --- a/packages/editor/src/core/extensions/custom-image/custom-image.ts +++ b/packages/editor/src/core/extensions/custom-image/custom-image.ts @@ -76,7 +76,6 @@ export const CustomImageExtension = (props: TFileHandler) => { imageSources.forEach(async (src) => { try { const assetUrlWithWorkspaceId = new URL(src).pathname.substring(1); - console.log("assetUrlWithWorkspaceId restore ", this.name, assetUrlWithWorkspaceId); await restoreImage(assetUrlWithWorkspaceId); } catch (error) { console.error("Error restoring image: ", error); diff --git a/packages/editor/src/core/extensions/image/extension.tsx b/packages/editor/src/core/extensions/image/extension.tsx index 2ed19f32655..1f15846a1a1 100644 --- a/packages/editor/src/core/extensions/image/extension.tsx +++ b/packages/editor/src/core/extensions/image/extension.tsx @@ -34,7 +34,6 @@ export const ImageExtension = (deleteImage: DeleteImage, restoreImage: RestoreIm imageSources.forEach(async (src) => { try { const assetUrlWithWorkspaceId = new URL(src).pathname.substring(1); - console.log("assetUrlWithWorkspaceId restore ", this.name, assetUrlWithWorkspaceId); await restoreImage(assetUrlWithWorkspaceId); } catch (error) { console.error("Error restoring image: ", error); diff --git a/packages/editor/src/core/hooks/use-file-upload.ts b/packages/editor/src/core/hooks/use-file-upload.ts index c0f6af2c269..3aea2d155cb 100644 --- a/packages/editor/src/core/hooks/use-file-upload.ts +++ b/packages/editor/src/core/hooks/use-file-upload.ts @@ -12,7 +12,6 @@ export const useUploader = ({ onUpload, editor }: { onUpload: (url: string) => v // @ts-expect-error - TODO: fix typings, and don't remove await from // here for now const url: string = await editor?.commands.uploadImage(file); - console.log("url upload", url); if (!url) { throw new Error("Something went wrong while uploading the image"); @@ -40,7 +39,6 @@ export const useFileUpload = () => { return { ref: fileInput, handleUploadClick }; }; - export const useDropZone = ({ uploader }: { uploader: (file: File) => void }) => { const [isDragging, setIsDragging] = useState(false); const [draggedInside, setDraggedInside] = useState(false); diff --git a/packages/editor/src/core/plugins/image/utils/validate-file.ts b/packages/editor/src/core/plugins/image/utils/validate-file.ts index b79ca6683e2..c86e99335fe 100644 --- a/packages/editor/src/core/plugins/image/utils/validate-file.ts +++ b/packages/editor/src/core/plugins/image/utils/validate-file.ts @@ -1,17 +1,23 @@ -export function isFileValid(file: File): boolean { +export function isFileValid(file: File, showAlert = true): boolean { if (!file) { - alert("No file selected. Please select a file to upload."); + if (showAlert) { + alert("No file selected. Please select a file to upload."); + } return false; } const allowedTypes = ["image/jpeg", "image/jpg", "image/png", "image/webp"]; if (!allowedTypes.includes(file.type)) { - alert("Invalid file type. Please select a JPEG, JPG, PNG, or WEBP image file."); + if (showAlert) { + alert("Invalid file type. Please select a JPEG, JPG, PNG, or WEBP image file."); + } return false; } if (file.size > 5 * 1024 * 1024) { - alert("File size too large. Please select a file smaller than 5MB."); + if (showAlert) { + alert("File size too large. Please select a file smaller than 5MB."); + } return false; }