0 Replies Latest reply on Apr 5, 2010 10:23 AM by dsidharta

    Detecting Paste When Handling TextOperationEvent.CHANGE?

    dsidharta

      Hi all,

       

      With the succession of events that are dispatched when a paste is performed on a Spark TextArea as follows:TextOperationEvent.CHANGING, TextOperationEvent.CHANGE, and then Event.PASTE, is there a way to tell that a paste operation is going on when handling  TextOperationEvent.CHANGE?

       

      One solution that comes to mind is listening to keyboard event, e.g. event.ctrlKey && String.fromCharCode(event.charCode) == "v", and then set a flag accordingly. But this seems too hacky, and plus I can't get it to work on Mac without resorting to listening to keyCode instead of charCode because KeyboardEvent.charCode is always 0:

       

      Mac: apple v

      [KeyboardEvent type="keyDown" bubbles=true cancelable=false eventPhase=3 charCode=0 keyCode=86 keyLocation=0 ctrlKey=true altKey=false shiftKey=false]

       

      Windows: ctrl v

      [KeyboardEvent type="keyDown" bubbles=true cancelable=false eventPhase=3 charCode=118 keyCode=86 keyLocation=0 ctrlKey=true altKey=false shiftKey=false]

       

      Many thanks in advance. Let me know if you need clarification on anything.