diff --git a/packages/text-editor/src/components/extension/fileUploadExt.ts b/packages/text-editor/src/components/extension/fileUploadExt.ts index b7e0a5576f..6c4030a780 100644 --- a/packages/text-editor/src/components/extension/fileUploadExt.ts +++ b/packages/text-editor/src/components/extension/fileUploadExt.ts @@ -92,11 +92,14 @@ export const FileUploadExtension = Extension.create({ } }, handleDrop (view, event) { - event.preventDefault() - event.stopPropagation() const dataTransfer = event.dataTransfer if (dataTransfer !== null) { - return handleDrop(view, view.posAtCoords({ left: event.x, top: event.y }), dataTransfer) + const res = handleDrop(view, view.posAtCoords({ left: event.x, top: event.y }), dataTransfer) + if (res === true) { + event.preventDefault() + event.stopPropagation() + } + return res } } } diff --git a/packages/text-editor/src/components/extension/imageUploadExt.ts b/packages/text-editor/src/components/extension/imageUploadExt.ts index bee4b3963b..852346e22c 100644 --- a/packages/text-editor/src/components/extension/imageUploadExt.ts +++ b/packages/text-editor/src/components/extension/imageUploadExt.ts @@ -118,11 +118,14 @@ export const ImageUploadExtension = Extension.create({ } }, handleDrop (view, event) { - event.preventDefault() - event.stopPropagation() const dataTransfer = event.dataTransfer if (dataTransfer !== null) { - return handleDrop(view, view.posAtCoords({ left: event.x, top: event.y }), dataTransfer) + const res = handleDrop(view, view.posAtCoords({ left: event.x, top: event.y }), dataTransfer) + if (res === true) { + event.preventDefault() + event.stopPropagation() + } + return res } } }