Skip to main content
Participating Frequently
June 13, 2014
Question

Unable to prevent default when pasting into TextField with AIR 14

  • June 13, 2014
  • 2 replies
  • 778 views

Hi,

Up until AIR 14 I was able to prevent the default behavior when pressing ctrl+v in a TextField with Air for Desktop. This allowed me to 'intercept' the pasted text and process it (removing junk markup from MS Word, but retaining some formatting) before adding it into the text field.

Now with AIR 14 calling preventDefault on the KEY_DOWN event on the TextField no longer prevents the paste action. Has anyone else experienced this? Since the TextField doesn't fire a PASTE event I have found no other way to prevent default pasting. I have filed a bug report here:

Bug#3775354 - Unable to prevent default when pasting into TextField with AIR 14

I looked at the change log for AIR 14 and there appears to be a bug fix for ctrl+v/c/x with StageText (which falls back to TextField on desktop). I wonder if this change has something to do with it? This pretty much breaks my entire application so I hope this can get resolved soon!

Thanks.

This topic has been closed for replies.

2 replies

nemenvAuthor
Participating Frequently
June 14, 2014

Thanks Chris. I look forward to an update.

chris.campbell
Legend
June 16, 2014

The team has been able to reproduce the issue.  Our internal bug number is 3776183.  We'll keep your external bug updated but feel free to reach out to me anytime for updates.

June 20, 2014

I've found an issue that is likely related involving the AdvancedDataGrid.  Overriding keyDownHandler no longer allows capture of CTRL+C, CTRL+V, or CTRL+X.  The workaround posted for bug #3775354 will not work in this case because the listener is added in the constructor in UIComponent.

Adding another key listener with useCapture=true does not intercept the above keystrokes.  I also tried setting priority to 100 and still cannot intercept them.  All other keystrokes I've tested work normally (CTRL+P, ALT+X, SHIFT+1, etc, etc).

Our application relies on these keystrokes to copy/cut/paste data between data grids and to/from Excel.  Our application is in production and being used by hundreds of people for data entry so this is extremely critical for us.  Please restore this behavior ASAP.

Thanks,

Kevin

chris.campbell
Legend
June 13, 2014

Thanks for the heads up.  I've asked someone to take a look at the bug report so expect an update shortly.

Thanks,

Chris