The following code can make RichTextArea auto-grow-or-shrink vertically based on KeyUp event,and question is how to do same thing when user paste or cut content in or out(Google plus has implemented this).MouseUp and CONTEXTMENU events have been tried,got no luck.Can anybody give a solution?Thanks.
public AutoResizeTextArea()
{
new Timer()
{
@Override
public void run()
{
(doc = ((FrameElement) getElement().cast()).getContentDocument()).getBody()
.setAttribute("style", "word-wrap:break-word;overflow:hidden;");
}
}.schedule(100);
}
@Override
public void onBrowserEvent(Event event)
{
switch (DOM.eventGetType(event))
{
case Event.ONKEYUP:
adjustHeight();
break;
}
}
private void adjustHeight()
{
if (doc.getDocumentElement()
.getOffsetHeight() != doc.getClientHeight())
{
setHeight((doc.getDocumentElement()
.getOffsetHeight() + 19) + "px");
}
}