fix: svg not supported in image uploads in the editor (#5558)

* fix: svg not supported in image uploads

* fix: svg image file error message fixed
This commit is contained in:
M. Palanikannan 2024-09-10 14:27:27 +05:30 committed by GitHub
parent 5eb868e07d
commit 069f8b950e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -146,7 +146,7 @@ export const insertImageCommand = (
if (range) editor.chain().focus().deleteRange(range).run();
const input = document.createElement("input");
input.type = "file";
input.accept = ".jpeg, .jpg, .png, .webp, .svg";
input.accept = ".jpeg, .jpg, .png, .webp";
input.onchange = async () => {
if (input.files?.length) {
const file = input.files[0];

View file

@ -4,9 +4,9 @@ export function isFileValid(file: File): boolean {
return false;
}
const allowedTypes = ["image/jpeg", "image/jpg", "image/png", "image/webp", "image/svg+xml"];
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, WEBP, or SVG image file.");
alert("Invalid file type. Please select a JPEG, JPG, PNG, or WEBP image file.");
return false;
}