Skip to content

Commit

Permalink
fix(ui): only get images from the clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Mar 8, 2023
1 parent 8f749de commit 7f53f43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/components/UploaderClipboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ const { loading, load } = useLoading(reqUpload)
// TODO: not attach handler to the whole document, just the main page
document.onpaste = async (event: ClipboardEvent) => {
const items = event.clipboardData?.items
const items = Array.from(event.clipboardData?.items ?? [])
if (!items) return
const blob = items[0]?.getAsFile()
const transferItem = items.find((it) => it.type.startsWith('image/'))
if (!transferItem) return
const blob = transferItem.getAsFile()
if (!blob) return
const formData = new FormData()
Expand Down

0 comments on commit 7f53f43

Please sign in to comment.