Richtext-area issue with HTML tags

Hello Team

I am facing issue with richtext-area after saving and providing the details below.

Details:
While adding texts in the richtext-area,I am able to find everything fine,but while customizing the texts,for instance-making it"bold"/“italic”/“underline” etc,I find the HTML tags in the list page.

To be honest,we found the same issue in the richtext-area,where I am writing. Going ahead,this resolution will help all of us.
Please help in fixing the issue in making the list page refreshment by avoiding html tags.Thanks in advance.

Regards
Anita

Hi Anita,
Please, send us a small sample project along with reproduction scenario that demonstrates the issue

Thanks Natalia for the response.

Here am attaching the screenshot from your richtext-area comment box.While making it bold,italic or any one from the customization panel,I find the HTML tags.So please find it and help me in fixing as I find the same issue in my application,while using your cuba richtext area.

Regards
Anita

pic1

pic2

pic3

Hi,
The documentation gives the example of how text is displayed in the component. However, the RichTextArea element generates HTML text. This is the reason why there are tags if you use the value from RichTextArea in the other components. Please, send us the screenshots of your own application and highlight the fields, where tags are displayed.

Natalia

Actually after saving the customized (bold,italic etc.) texts in the richtext area,I find the HTMLtags with the texts in the list page and database even.Whereas I want the texts without the HTML tags in the list page and database.
So how to go ahead?or still we have to attach some screenshots of our application?

Thanks again for your support.

Regards
Anita

You should not clear the tags in the database because otherwise all your customizing will be lost. There are two ways to display text from the RichTextArea component in the other components without tags:

  • Create a generated column for displaying the customized text. For example, we have the TestEntity and the Name column in which we want to display the RichTextArea value without tags. We should write the following code in the screen controller:
    
    @Inject
        private Table<TestEntity> testEntitiesTable;
        @Inject
        private ComponentsFactory componentsFactory;
    
        @Override
        public void init(Map<String, Object> params) {
            testEntitiesTable.addGeneratedColumn("name", entity -> {
                Label label = componentsFactory.createComponent(Label.class);
                label.setHtmlEnabled(true);
                label.setValue(entity.getName());
                return label;
            });
        }
    
  • Clean all tags from the RichTextArea value before inserting it in other components. You can use a simple regex like replaceAll("\\<.*?>","") for it

Natalia

Thanks for the update.
I have tried with the second one ,using simple regex like replaceAll("\<.?>","").
for example - Suppose the richtextarea id = “text”, String saveText = text.replaceAll("\<.
?>",""), and we have to convert the text free from html tags and set it again to the richtextarea ,we used “text.setText(saveText )”. But it is not working and is displaying the text with html tags in the list page.
Please help me to figure it out.

Regards
Anita

Anita, please, send us a small sample project along with reproduction scenario that demonstrates the issue.