I cant try it out right now, but I've bookmarked for later.
This is going to be VERY usefull.
You might also have been the first guy online to work this out based
on my (long) Googleing on this over the last month or so ;)
On Nov 2, 3:33 am, Brandon Donnelson <branflake2...@gmail.com> wrote:
> I found a nice hack to get the onpaste to work: I modified the source to
> try it.
>
> // my inherited RichTextArea
> public WiseRichTextArea(boolean hideBorderUntilHover, boolean grow) {
> super();
> setup(hideBorderUntilHover, grow);
> }
>
> private void setup(boolean hideBorderUntilHover, boolean grow) {
> this.hideBorderUntilHover = hideBorderUntilHover;
> this.grow = grow;
>
> addStyleName("gv-core-WiseRichTextArea");
>
> setUpEditHover();
>
> setupHandlers();
>
> sinkEvents(Event.ONPASTE);
> }
>
> @Override
> public void onBrowserEvent(Event event) {
> super.onBrowserEvent(event);
> switch (event.getTypeInt()) {
> case Event.ONPASTE:
> System.out.println("Paste Detected");
> Window.alert("Paste Works!!! Yippie!!!");
> break;
> }
> }
>
> My hack:
>
> // RichTextAreaImplSafari.java source hack
> @Override
> protected native void hookEvents() /*-{
> var elem = th...@com.google.gwt.user.client.ui.impl.RichTextAreaImpl::elem;
> var wnd = elem.contentWindow;
>
> elem.__gwt_handler = function(evt) {
> if (elem.__listener) {
> if (@com.google.gwt.user.client.impl.DOMImpl::isMyListener(Ljava/lang/Object;)(elem.__listener)) {
> @com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt, elem, elem.__listener);
> }
> }
> };
>
> wnd.addEventListener('keydown', elem.__gwt_handler, true);
> wnd.addEventListener('keyup', elem.__gwt_handler, true);
> wnd.addEventListener('keypress', elem.__gwt_handler, true);
> wnd.addEventListener('mousedown', elem.__gwt_handler, true);
> wnd.addEventListener('mouseup', elem.__gwt_handler, true);
> wnd.addEventListener('mousemove', elem.__gwt_handler, true);
> wnd.addEventListener('mouseover', elem.__gwt_handler, true);
> wnd.addEventListener('mouseout', elem.__gwt_handler, true);
> wnd.addEventListener('click', elem.__gwt_handler, true);
>
> // Whats needed . this works.
> wnd.addEventListener('paste', elem.__gwt_handler, true);
>
> // Focus/blur event handlers. For some reason, [add|remove]eventListener()
> // doesn't work on the iframe element (at least not for focus/blur). Don't
> // dispatch through the normal handler method, as some of the querying we do
> // there interferes with focus.
> wnd.onfocus = function(evt) {
> if (elem.__listener) {
> @com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt, elem, elem.__listener);
> }
> };
>
> wnd.onblur = function(evt) {
> if (elem.__listener) {
> @com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt, elem, elem.__listener);
> }
> };
> }-*/;
>
> I'll submit all the source tomorrow.
>
> Brandon Donnelsonhttp://gwt-examples.googlecode.com
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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