Results 1 to 3 of 3

Thread: Accessing ClipBoard Text

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    10
    Answers
    2
    Vote Rating
    0
      0  

    Default Accessing ClipBoard Text

    Hello,

    Does anybody know how to access clipboard text in Ext JS.?
    Do we have onpaste event for textfield component??

    -Shiva

  2. #2
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505
    Vote Rating
    255
      0  

    Default

    Thus far in my travels I've not seen code that will copy to the clipboard in Ext (I've yet to find code that will do it cross-browser at all, honestly. All I've personally been able to get working is IE). So, perhaps another community member can guide you (and by extension me) to a solution.

    I believe the closest thing you'll find to an onpaste event is the change event. In Ext 2/3 I used to watch for keyup events and that would fall apart when you paste using the mouse / context menu. So, I'd set up a repeating task to monitor the field - not a great use of resources, really, but that's what I did. Now with Ext 4 you can just listen to the change event and that will trigger whenever the field value is changed no matter the execution.

  3. #3
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Answers
    15
    Vote Rating
    10
      0  

    Default

    It's certainly useful, but considered to be a security risk, and so browsers other than IE won't give you access to it. With IE, you use "window.clipboardData.getData()" or "window.clipboardData.getText()" to get the text.

    HTML5 is supposed to provide clipboard events, and the clipboard data is passed within the events, but there's little to no implementation of this available.

    One sleazy way to get around this is with a Flash hack (http://code.google.com/p/zeroclipboard/)

    Sorry there aren't better answers out there!

    stevil

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •