Closed dankurka closed 9 years ago
Reported by clayberg@google.com
on 2011-11-23 14:31:10
PatchesWelcome
Alexander, you mentioned having patched TextArea for this, can you attach an example
of your implementation? And what do you mean by auto-resizing? Based on the size of
the text box's content, or the size of the browser window?
Reported by stephen.haberman
on 2011-11-24 03:41:18
For TextArea,I just followed this blog:http://ambitz.com/2010/12/11/autogrow-textarea-with-gwt/,and
I hope RichTextBox can support auto-resizing(auto-growing and auto-shrinking),but it
is not so easy for me to implement it.
Reported by Alexander.Luya
on 2011-11-25 06:06:57
Below 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");
}
}
Reported by Alexander.Luya
on 2012-04-25 14:27:51
Reported by dankurka@google.com
on 2013-05-28 01:46:09
AssumedStale
Originally reported on Google Code with ID 7012
Reported by
Alexander.Luya
on 2011-11-22 03:49:25