Skip to content

Commit

Permalink
fix: only paste as image if payload does not contain text content (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
maltesa authored Dec 5, 2024
1 parent da50ea9 commit 62441a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ export const imageDialogState$ = Cell<InactiveImageDialogState | NewImageDialogS
return false // If from web, bail.
}

let cbPayload = Array.from(event.clipboardData?.items ?? [])
cbPayload = cbPayload.filter((i) => i.type.includes('image')) // Strip out the non-image bits
const cbPayload = Array.from(event.clipboardData?.items ?? [])
const isMixedPayload = cbPayload.some((item) => !item.type.includes('image'))
if (isMixedPayload) return false

if (!cbPayload.length || cbPayload.length === 0) {
return false
Expand Down

0 comments on commit 62441a3

Please sign in to comment.