fix(editor): don't create empty "blob" files when pasting images
This commit is contained in:
parent
23d670525d
commit
debae2326e
@ -507,12 +507,16 @@ onBeforeUnmount(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function handleImagePaste(event) {
|
function handleImagePaste(event) {
|
||||||
|
if (event?.clipboardData?.items?.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event?.clipboardData?.items?.forEach(i => {
|
|
||||||
if (i.kind === 'file' && i.type.startsWith('image/')) {
|
const image = event.clipboardData.items[0]
|
||||||
uploadAndInsertFiles([i.getAsFile()])
|
if (image.kind === 'file' && image.type.startsWith('image/')) {
|
||||||
}
|
uploadAndInsertFiles([image.getAsFile()])
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/github/hotkey/discussions/85#discussioncomment-5214660
|
// See https://github.com/github/hotkey/discussions/85#discussioncomment-5214660
|
||||||
|
Loading…
x
Reference in New Issue
Block a user