Sunday, October 30, 2011

I can't get RichTextAre OnPaste Event hooking|sinking to work?

I'm trying to observe the OnPaste Event but can't seem to hook it into the RichTextArea and not sure why yet.


http://code.google.com/p/gwt-examples/source/browse/trunk/GoneVertical-Core/src/org/gonevertical/core/client/input/richtext/WiseRichTextArea.java#178 - source (snippet below)
     // deal with messy pasting
   
/**
     * TODO - No Worky - iframe? I see the ook events in the RichTextAreaImpl and how come I can't hook them in here?
     */

    sinkEvents
(Event.ONPASTE); // TODO ? no worky
    DOM
.sinkEvents(getElement(), Event.ONPASTE); //TODO ? no worky
   
   
//sinkEvents(Event.ONKEYUP);

   
/**
     * TODO this won't work either, b/c it won't capture once focued on richtextarea  
     */

   
Event.addNativePreviewHandler(new NativePreviewHandler() {
     
public void onPreviewNativeEvent(NativePreviewEvent event) {
       
NativeEvent ne = event.getNativeEvent();
       
if (event.getTypeInt() == Event.ONPASTE) {
         
System.out.println("Pasting?????");
         
Window.alert("works");
       
}
       
System.out.println("event.toDebutString()=" + event.toDebugString() + " ne.getType=" + ne.getType() + " ne.toString=" + ne.toString() + " charCode=" + ne.getCharCode() + " key=" + (char)ne.getCharCode());
     
}
   
});

Has anybody hooked the onpaste event onto richtextarea? 


Thanks 
Brandon Donnelson
http://gwt-examples.googlecode.com




--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/43B97Gt1FQcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment