How to modify Enter key behavior in RichTextArea?

35 views
Skip to first unread message

dhoffer

unread,
Jan 4, 2013, 1:28:13 PM1/4/13
to google-we...@googlegroups.com
Pressing the Enter key in RichTextArea creates a new line (and adds '<br><br>' to the html content) but if the Ctrl key is down then it doesn't.  That makes sense for normal text editing but I want to basically reverse that.  Where is this behavior coded?  Is that controlled in GWT code or is that just the behavior of the browser? 

I tried overriding onBrowserEvent() and adding '<br><br>' if the control key is down but that didn't help.

Then I went looking for a setCursorPosition method on RichTextArea but didn't find one.  It seems lots of folks have asked for that.

What's the best way to solve this?  Is there some custom setSelectionRange() logic out there for setting the cursor position?  I found a couple of JSNI examples of this but they didn't work...perhaps because my browser is too new, not sure.

-Dave
Reply all
Reply to author
Forward
0 new messages