richTextEditor

An area to input text with rich formatting. It supports a variety of formatting options such as bold, italics, underlining, text alignment along with adding links, images, code blocks and more, to make text visually appealing and well-structured.

  • XML element: richTextEditor

  • Java class: RichTextEditor

Basics

To add the component on a view, place it in the view descriptor:

<richTextEditor id="richTextEditor"/>

Users can type and edit text using the tools in the top bar.

rich text editor

HTML Input

In addition to user input, text can also be programmatically entered into the component. This can be plain text or text formatted with standard HTML tags.

@ViewComponent
private RichTextEditor richTextEditor;
@Subscribe
public void onInit(final InitEvent event) {
    richTextEditor.setValue("<i>Jackdaws </i><u>love</u> " +
            "my <b>big</b> <sup>sphinx</sup> of " +
            "<span style=\"background-color:red;\">quartz</span>");
}
rich text editor html

Data Binding

The component can display the content of an entity’s attribute, which may be plain text or text formatted with standard HTML tags.

To bind richTextEditor to an entity attribute:

  1. Set the name of the data container to as the dataContainer attribute value.

  2. Set the name of an attribute as the property attribute value.

Handlers

Чтобы сгенерировать заглушку обработчика в Jmix Studio, используйте вкладку Handlers панели инспектора Jmix UI, или команду Generate Handler, доступную на верхней панели контроллера экрана и через меню CodeGenerate (Alt+Insert / Cmd+N).