You cannot add the event to the RichTextArea
, which actually is an iframe
, but to it's body.
Although you could use jsni
, I would use gwtquery because its simplicity:
// First attach the widget to the DOM
RootPanel.get().add(richTextArea);
// We only can bind events to the content, once the iframe document has been created,
// and this happens after it has been attached. Note that richtTextArea uses a timeout
// to initialize, so we have to delay the event binding as well
$(richTextArea).delay(1, lazy().contents().find("body").bind(Event.ONPASTE, new Function(){
@Override public boolean f(Event e) {
Window.alert("OnPaste");
return true;
}
}).done());