mercredi 10 janvier 2018

Capture Paste Content in Ember 2.6

I have an Ember App (Ember 2.6) and I am trying to capture paste data before it is pasted into a input component. I have tried registering a custom event in my Ember App following the docs.

http://ift.tt/2FkSn10

Then in my component...

paste: function(event) {
    console.log(event.originalEvent.clipboardData.getData('text/plain'))
}

This returns an empty string when pasting "foo".

I also tried this with jquery...

$('.table').on('paste',function(event) {
  console.log(event.originalEvent.clipboardData.getData('text/plain'))
}

This also returns an empty string.

I have read other stack overflow answers surrounding this issue and haven't found a solution that works for me. I have tried...

event.clipboardData.getData('text/plain')
window.clipboardData..getData('text/plain')

For getData() I have also tried...

'text', and 'Text'

What do I do?




Aucun commentaire:

Enregistrer un commentaire