π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
chore: gif support for editor (#6219)
Aaryan Khandelwal5773c2bde3d3
diff --git a/apiserver/plane/app/views/asset/v2.py b/apiserver/plane/app/views/asset/v2.pyindex 827c959084..3c1442022f 100644--- a/apiserver/plane/app/views/asset/v2.py+++ b/apiserver/plane/app/views/asset/v2.py@@ -126,7 +126,13 @@ class UserAssetsV2Endpoint(BaseAPIView):)# Check if the file type is allowed- allowed_types = ["image/jpeg", "image/png", "image/webp", "image/jpg"]+ allowed_types = [+ "image/jpeg",+ "image/png",+ "image/webp",+ "image/jpg",+ "image/gif",+ ]if type not in allowed_types:return Response({diff --git a/apiserver/plane/space/views/asset.py b/apiserver/plane/space/views/asset.pyindex 2c67220384..3e1d4d6f78 100644--- a/apiserver/plane/space/views/asset.py+++ b/apiserver/plane/space/views/asset.py@@ -86,7 +86,13 @@ class EntityAssetEndpoint(BaseAPIView):)# Check if the file type is allowed- allowed_types = ["image/jpeg", "image/png", "image/webp"]+ allowed_types = [+ "image/jpeg",+ "image/png",+ "image/webp",+ "image/jpg",+ "image/gif",+ ]if type not in allowed_types:return Response({diff --git a/packages/editor/src/core/constants/config.ts b/packages/editor/src/core/constants/config.tsindex 5a9577044c..bd4712de99 100644--- a/packages/editor/src/core/constants/config.ts+++ b/packages/editor/src/core/constants/config.ts@@ -5,3 +5,6 @@ export const DEFAULT_DISPLAY_CONFIG: TDisplayConfig = {fontSize: "large-font",fontStyle: "sans-serif",};++export const ACCEPTED_FILE_MIME_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp", "image/gif"];+export const ACCEPTED_FILE_EXTENSIONS = ACCEPTED_FILE_MIME_TYPES.map((type) => `.${type.split("/")[1]}`);diff --git a/packages/editor/src/core/extensions/custom-image/components/image-uploader.tsx b/packages/editor/src/core/extensions/custom-image/components/image-uploader.tsxindex 7d0076fb7c..eaea423878 100644--- a/packages/editor/src/core/extensions/custom-image/components/image-uploader.tsx+++ b/packages/editor/src/core/extensions/custom-image/components/image-uploader.tsx@@ -2,6 +2,8 @@ import { ChangeEvent, useCallback, useEffect, useMemo, useRef } from "react";import { ImageIcon } from "lucide-react";// plane utilsimport { cn } from "@plane/utils";+// constants+import { ACCEPTED_FILE_EXTENSIONS } from "@/constants/config";// hooksimport { useUploader, useDropZone, uploadFirstImageAndInsertRemaining } from "@/hooks/use-file-upload";// extensions@@ -166,7 +168,7 @@ export const CustomImageUploader = (props: CustomImageUploaderProps) => {ref={fileInputRef}hiddentype="file"- accept=".jpg,.jpeg,.png,.webp"+ accept={ACCEPTED_FILE_EXTENSIONS.join(",")}onChange={onFileChange}multiple/>diff --git a/packages/editor/src/core/plugins/image/utils/validate-file.ts b/packages/editor/src/core/plugins/image/utils/validate-file.tsindex db88f3f73c..703bb2bf0a 100644--- a/packages/editor/src/core/plugins/image/utils/validate-file.ts+++ b/packages/editor/src/core/plugins/image/utils/validate-file.ts@@ -1,3 +1,6 @@+// constants+import { ACCEPTED_FILE_MIME_TYPES } from "@/constants/config";+type TArgs = {file: File;maxFileSize: number;@@ -11,9 +14,8 @@ export const isFileValid = (args: TArgs): boolean => {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 (!ACCEPTED_FILE_MIME_TYPES.includes(file.type)) {+ alert("Invalid file type. Please select a JPEG, JPG, PNG, WEBP or GIF file.");return false;}