Skip to content

Commit

Permalink
fix(firefox): Auto pasting not working when encryption user's posts
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Aug 3, 2019
1 parent c3cb73e commit 815e5b6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/extension/injected-script/addEventListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ export interface CustomEvents {

const hacks: { [key in keyof CustomEvents & keyof DocumentEventMap]: (...params: CustomEvents[key]) => Event } = {
paste(text) {
const transfer = new DataTransfer()
transfer.setData('text/plain', text)
const e = new ClipboardEvent('paste', { clipboardData: transfer })
const e = new ClipboardEvent('paste', { clipboardData: new DataTransfer() })
e.clipboardData!.setData('text/plain', text)
// ! Why?
return getEvent(e, { defaultPrevented: false, preventDefault() {} })
},
Expand Down

0 comments on commit 815e5b6

Please sign in to comment.