Search code examples
gwtweb-applicationstextarea

Editable text widget for GWT?


I have an app in GWT that provides lots of little paragraphs and let's the user edit them. Right now I just have a view mode, just an HTML paragraph, and an edit mode, for which I use a standard HTML TextArea.

Is there a fluid GWT paragraph editing widget that does not require using a TextArea or switching between modes? Note that I do not need a rich text widget as I don't want bold, italic, bullet points, etc.

I would be willing to use a jQuery or other JavaScript library solution as long as it was really robust and cleanly separated from everything else I'm doing. I don't want to babysit/hack on JavaScript.

Somehow I think this problem is hard, as Google Docs doesn't do it well and even stackoverflow has me using a very TextArea-like box to edit text that is later displayed as an HTML paragraph.


Solution

  • I would use HTML ContentEditable. http://html5demos.com/contenteditable/

    <div contenteditable="true">
    </div>
    

    You can use a JS framework to bind to changes. I have noticed issues with the JS 'change' event, but the 'blur' event works well.