[WIKI-412] regression: drop plugin logic #7161

This commit is contained in:
Aaryan Khandelwal 2025-06-04 19:07:49 +05:30 committed by GitHub
parent ef3ec7274c
commit 1113f9fc19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ import { ACCEPTED_ATTACHMENT_MIME_TYPES, ACCEPTED_IMAGE_MIME_TYPES } from "@/con
import { TEditorCommands, TExtensions } from "@/types"; import { TEditorCommands, TExtensions } from "@/types";
type Props = { type Props = {
disabledExtensions: TExtensions[]; disabledExtensions?: TExtensions[];
editor: Editor; editor: Editor;
}; };
@ -83,7 +83,7 @@ export const DropHandlerPlugin = (props: Props): Plugin => {
}; };
type InsertFilesSafelyArgs = { type InsertFilesSafelyArgs = {
disabledExtensions: TExtensions[]; disabledExtensions?: TExtensions[];
editor: Editor; editor: Editor;
event: "insert" | "drop"; event: "insert" | "drop";
files: File[]; files: File[];
@ -111,7 +111,7 @@ export const insertFilesSafely = async (args: InsertFilesSafelyArgs) => {
else if (ACCEPTED_ATTACHMENT_MIME_TYPES.includes(file.type)) fileType = "attachment"; else if (ACCEPTED_ATTACHMENT_MIME_TYPES.includes(file.type)) fileType = "attachment";
} }
// insert file depending on the type at the current position // insert file depending on the type at the current position
if (fileType === "image" && !disabledExtensions.includes("image")) { if (fileType === "image" && !disabledExtensions?.includes("image")) {
editor.commands.insertImageComponent({ editor.commands.insertImageComponent({
file, file,
pos, pos,