Skip to content

Commit

Permalink
Add note in RichTextEditor documentation about asRequired use
Browse files Browse the repository at this point in the history
  • Loading branch information
TatuLund authored Mar 6, 2025
1 parent 5c639cc commit 2c0cfa7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions articles/components/rich-text-editor/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ For the Flow component, the default is the HTML format, which is also used autom

To read, write, or bind the component's value using the Delta format, use the https://vaadin.com/api/platform/{moduleMavenVersion:com.vaadin:vaadin}/com/vaadin/flow/component/richtexteditor/RichTextEditor.html#asDelta()[`RichTextEditor.asDelta()`] wrapper.

[NOTE]
Due nature of the component the default `asRequired` validator is not working as expected with `Binder`. Hence custom validator needs to be used.

[.example]

--

ifdef::flow[]
[source,java]
----
binder.forField(richTextEditor)
.asRequired(Validator.from(value -> !richTextEditor.isEmpty(), "Required"))
----
endif::[]
--

For the web component, to read or write the value in the Delta format, use the `value` property.

To read or write the value in the HTML format, use the `htmlValue` property and the `dangerouslySetHtmlValue` method.
Expand Down

0 comments on commit 2c0cfa7

Please sign in to comment.