fix for [D4Science Infrastructure - Incident #393] Share Updates: users tagging does not work in Firefox

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@117299 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-07-17 10:32:52 +00:00
parent c22c4f5ce6
commit fd90283182
1 changed files with 10 additions and 6 deletions

View File

@ -5,7 +5,6 @@ package org.gcube.portlets.user.newsfeed.client.ui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import org.gcube.portlets.user.gcubewidgets.client.elements.Div; import org.gcube.portlets.user.gcubewidgets.client.elements.Div;
import org.gcube.portlets.user.newsfeed.client.NewsService; import org.gcube.portlets.user.newsfeed.client.NewsService;
@ -19,6 +18,8 @@ import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Event;
@ -51,7 +52,6 @@ public class SuperPosedTextArea extends TextArea {
*/ */
public SuperPosedTextArea(Div highlighterDIV) { public SuperPosedTextArea(Div highlighterDIV) {
sinkEvents(Event.ONPASTE); sinkEvents(Event.ONPASTE);
sinkEvents(Event.ONKEYPRESS);
sinkEvents(Event.ONCONTEXTMENU); sinkEvents(Event.ONCONTEXTMENU);
sinkEvents(Event.ONKEYDOWN); sinkEvents(Event.ONKEYDOWN);
sinkEvents(Event.ONKEYUP); sinkEvents(Event.ONKEYUP);
@ -80,6 +80,14 @@ public class SuperPosedTextArea extends TextArea {
} }
}; };
t.schedule(200); t.schedule(200);
this.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
pickUserDlg.onKeyPress(getCursorPos(), event.getUnicodeCharCode(), getAbsoluteLeft(), getAbsoluteTop()+getOffsetHeight(), getText());
}
});
} }
/** /**
* This is the way to wrap jQuery plugins into GWT, wrap it in a function and call it. * This is the way to wrap jQuery plugins into GWT, wrap it in a function and call it.
@ -111,10 +119,6 @@ public class SuperPosedTextArea extends TextArea {
} }
break; break;
} }
case Event.ONKEYPRESS: {
pickUserDlg.onKeyPress(this.getCursorPos(), event.getKeyCode(), this.getAbsoluteLeft(), this.getAbsoluteTop()+this.getOffsetHeight(), getText());
break;
}
case Event.ONKEYUP: { case Event.ONKEYUP: {
injectInDiv(getText()); injectInDiv(getText());
pickUserDlg.onKeyUp(event.getKeyCode()); pickUserDlg.onKeyUp(event.getKeyCode());