UBERF-7065 Fix file and image upload extensions (#5668)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-05-27 14:25:23 +07:00 committed by GitHub
parent 2e6b0f3937
commit 27a98e0641
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -92,11 +92,14 @@ export const FileUploadExtension = Extension.create<FileUploadOptions>({
}
},
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
}
}
}

View File

@ -118,11 +118,14 @@ export const ImageUploadExtension = Extension.create<ImageUploadOptions>({
}
},
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
}
}
}