From 613ed008fc68a283e734e0754df6199e22a664cc Mon Sep 17 00:00:00 2001 From: Sunwood-ai-labs <108736814+Sunwood-ai-labs@users.noreply.github.com> Date: Sun, 3 May 2026 14:55:21 +0900 Subject: [PATCH] Allow PNG custom background uploads --- src/components/video-editor/SettingsPanel.tsx | 7 +++---- .../backgroundImageUpload.test.ts | 20 +++++++++++++++++++ .../video-editor/backgroundImageUpload.ts | 20 +++++++++++++++++++ src/i18n/locales/en/settings.json | 2 +- src/i18n/locales/es/settings.json | 2 +- src/i18n/locales/fr/settings.json | 2 +- src/i18n/locales/ja-JP/settings.json | 2 +- src/i18n/locales/ko-KR/settings.json | 2 +- src/i18n/locales/tr/settings.json | 2 +- src/i18n/locales/zh-CN/settings.json | 2 +- src/i18n/locales/zh-TW/settings.json | 2 +- 11 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 src/components/video-editor/backgroundImageUpload.test.ts create mode 100644 src/components/video-editor/backgroundImageUpload.ts diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx index 82e106c5..5ac59796 100644 --- a/src/components/video-editor/SettingsPanel.tsx +++ b/src/components/video-editor/SettingsPanel.tsx @@ -43,6 +43,7 @@ import { getTestId } from "@/utils/getTestId"; import ColorPicker from "../ui/color-picker"; import { AnnotationSettingsPanel } from "./AnnotationSettingsPanel"; import { BlurSettingsPanel } from "./BlurSettingsPanel"; +import { BACKGROUND_IMAGE_ACCEPT, isSupportedBackgroundImageType } from "./backgroundImageUpload"; import { CropControl } from "./CropControl"; import { KeyboardShortcutsHelp } from "./KeyboardShortcutsHelp"; import type { @@ -459,9 +460,7 @@ export function SettingsPanel({ const file = files[0]; - // Validate file type - only allow JPG/JPEG - const validTypes = ["image/jpeg", "image/jpg"]; - if (!validTypes.includes(file.type)) { + if (!isSupportedBackgroundImageType(file.type, file.name)) { toast.error(t("imageUpload.invalidFileType"), { description: t("imageUpload.jpgOnly"), }); @@ -1041,7 +1040,7 @@ export function SettingsPanel({ type="file" ref={fileInputRef} onChange={handleImageUpload} - accept=".jpg,.jpeg,image/jpeg" + accept={BACKGROUND_IMAGE_ACCEPT} className="hidden" />