Gwt, how to make "Rich Text Area" to accept only a few features such as Bold Italic & remove all others?

937 Views Asked by At

Let say, when u create a new post in stackoverflow, then u can only set old,
& some very simple Html tags.

The "Rich Text Area" in Gwt has too many features that I don't need. i just need Bold, italic, Underline & hyperlink. So How to customize the "Rich Text Area" so that it only accepts some limioted of features.

Also, when user put any formatted text from internet into the "Rich Text Area", it will clear all the formats but keep Bold, italic, Underline & Hyperlink.

The other solution is to make Text Area to work like RichText Area??

So, do u have any idea how to do it?

1

There are 1 best solutions below

1
On

There isn't a method where you can go richTextAreaToolbar.setActiveBlagh(false), which honestly would be amazing.

Since GWT uses a default RichTextToolbar, you need a custom RichTextToolbar.

Code

Use the code from there, but remove all the unnecessary functionality like color/images/etc. You could even add your own if you so wish. It will take a while, but being able to customize your own widgets is so much more satisfying.

EDIT: Here is another link to give you advice on how to set it all up: Custom RichTextToolbar