[D4Science Infrastructure - Incident #393] Share Updates: users tagging does not work in Firefox
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@117300 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3e72d59d1c
commit
3943cd1df1
|
@ -16,6 +16,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;
|
||||||
|
@ -45,7 +47,7 @@ public class SuperPosedTextArea extends TextArea {
|
||||||
*/
|
*/
|
||||||
public SuperPosedTextArea() {
|
public SuperPosedTextArea() {
|
||||||
sinkEvents(Event.ONPASTE);
|
sinkEvents(Event.ONPASTE);
|
||||||
sinkEvents(Event.ONKEYPRESS);
|
//sinkEvents(Event.ONKEYPRESS);
|
||||||
sinkEvents(Event.ONCONTEXTMENU);
|
sinkEvents(Event.ONCONTEXTMENU);
|
||||||
sinkEvents(Event.ONKEYDOWN);
|
sinkEvents(Event.ONKEYDOWN);
|
||||||
sinkEvents(Event.ONKEYUP);
|
sinkEvents(Event.ONKEYUP);
|
||||||
|
@ -74,6 +76,15 @@ public class SuperPosedTextArea extends TextArea {
|
||||||
|
|
||||||
getElement().setAttribute("id", "postTextArea");
|
getElement().setAttribute("id", "postTextArea");
|
||||||
bind();
|
bind();
|
||||||
|
|
||||||
|
this.addKeyPressHandler(new KeyPressHandler() {
|
||||||
|
@Override
|
||||||
|
public void onKeyPress(KeyPressEvent event) {
|
||||||
|
pickUserDlg.onKeyPress(getCursorPos(), event.getUnicodeCharCode(), getAbsoluteLeft(), getAbsoluteTop()+getOffsetHeight(), getText());
|
||||||
|
pickHashtagDlg.onKeyPress(getCursorPos(), event.getUnicodeCharCode(), getAbsoluteLeft(), getAbsoluteTop()+getOffsetHeight(), getText());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,11 +113,6 @@ public class SuperPosedTextArea extends TextArea {
|
||||||
t.schedule(100);
|
t.schedule(100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Event.ONKEYPRESS: {
|
|
||||||
pickUserDlg.onKeyPress(this.getCursorPos(), event.getKeyCode(), this.getAbsoluteLeft(), this.getAbsoluteTop()+this.getOffsetHeight(), getText());
|
|
||||||
pickHashtagDlg.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());
|
||||||
|
@ -149,7 +155,7 @@ public class SuperPosedTextArea extends TextArea {
|
||||||
DOM.getElementById("highlighter").setInnerHTML("");
|
DOM.getElementById("highlighter").setInnerHTML("");
|
||||||
}
|
}
|
||||||
private void injectInDiv(String textAreaText) {
|
private void injectInDiv(String textAreaText) {
|
||||||
GWT.log("# injectInDiv: "+textAreaText);
|
//GWT.log("# injectInDiv: "+textAreaText);
|
||||||
String text;
|
String text;
|
||||||
// parse the text:
|
// parse the text:
|
||||||
// replace all the line breaks by <br/>, and all the double spaces by the html version
|
// replace all the line breaks by <br/>, and all the double spaces by the html version
|
||||||
|
@ -193,7 +199,7 @@ public class SuperPosedTextArea extends TextArea {
|
||||||
|
|
||||||
String preceedingPart = getText().substring(0, event.getItemCursorIndexStart());
|
String preceedingPart = getText().substring(0, event.getItemCursorIndexStart());
|
||||||
String afterPart = getText().substring(event.getItemCursorIndexEnd()+1);
|
String afterPart = getText().substring(event.getItemCursorIndexEnd()+1);
|
||||||
|
|
||||||
setText(preceedingPart + toAdd + " " + afterPart);
|
setText(preceedingPart + toAdd + " " + afterPart);
|
||||||
injectInDiv(getText());
|
injectInDiv(getText());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue