You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If set options.onCopy, and NOT set options.format, copy will failed.
importcopyfrom'copy-to-clipboard'copy('text',{// do NOT set formatonCopy: ()=>{// onCopy callback will be triggered// but WONT copy correctly},})
because:
mark.addEventListener('copy',function(e){if(options.format){// the preventDefault() is oke.preventDefault()// do something...// re-set the clipboard data hereclipboard.setData(options.format,text)}if(options.onCopy){// the preventDefault() prevent the default copy behavior// it cause a bug// the preventDefault() should be removed.e.preventDefault()options.onCopy(e.clipboardData);}})
The text was updated successfully, but these errors were encountered:
xiaomingTang
pushed a commit
to xiaomingTang/copy-to-clipboard
that referenced
this issue
Apr 14, 2023
https://github.com/sudodoki/copy-to-clipboard/blob/main/index.js#L69
If set
options.onCopy
, and NOT setoptions.format
, copy will failed.because:
The text was updated successfully, but these errors were encountered: