0

If we perform cut or copy in the browser text box and perform a paste else where. Can we detect whether the source is from cut or copy from the paste event in browsers ?

document.querySelector('.box').addEventListener('paste', function(event) {
  // How can we identify wheter cut or copy is performed on text from the paste event


})
.box {
  background: red;
  height: 200px;
  width: 200px;
}
<textarea> </textarea>

<div class='box' tabIndex=0> </div>
vishnu sandhireddy
  • 1,148
  • 1
  • 7
  • 12
  • 1
    I don't think that you can. – nsrCodes Feb 08 '21 at 06:50
  • 2
    Check the MIME type of clipboardData. Refer [this](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent), [this](https://stackoverflow.com/questions/31790587/how-to-determine-mime-type-of-copy-pasted-image-clipboard) and [this](https://stackoverflow.com/questions/36270886/event-clipboarddata-setdata-in-copy-event) – kiranvj Feb 08 '21 at 06:53

0 Answers0